pytest-dev / pytest

The pytest framework makes it easy to write small tests, yet scales to support complex functional testing
https://pytest.org
MIT License
11.98k stars 2.66k forks source link

TypeError: attrib() got an unexpected keyword argument 'convert' #8301

Closed tamhanepd closed 3 years ago

tamhanepd commented 3 years ago

When I import aplpy package in jupyter notebook, I get the following error. Looks like the problem is in the Pytest package:

Traceback (most recent call last): File "/home/user/.local/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3343, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in import aplpy File "/home/user/.local/lib/python3.6/site-packages/aplpy/init.py", line 14, in from .core import FITSFigure # noqa File "/home/user/.local/lib/python3.6/site-packages/aplpy/core.py", line 22, in from astropy.visualization.wcsaxes import WCSAxes, WCSAxesSubplot File "/home/user/.local/lib/python3.6/site-packages/astropy/visualization/wcsaxes/init.py", line 7, in import pytest File "/usr/lib/python3/dist-packages/pytest.py", line 13, in from _pytest.fixtures import fixture, yield_fixture File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 842, in class FixtureFunctionMarker(object): File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 844, in FixtureFunctionMarker params = attr.ib(convert=attr.converters.optional(tuple)) TypeError: attrib() got an unexpected keyword argument 'convert'

Relevant package versions from pip list: pytest 6.2.2 APLpy 2.0.3 attrs 19.3.0

Python version: 3.6.9 OS: Ubuntu 18.04.5 LTS

What is going wrong here?

RonnyPfannschmidt commented 3 years ago

Severely outdated attrs, please updated attrs

antonblr commented 3 years ago

@tamhanepd - what astropy version is pulled? Looking at the stacktrace it seems like astropy is using very old pytest:

File "/home/user/.local/lib/python3.6/site-packages/astropy/visualization/wcsaxes/init.py", line 7, in
import pytest
File "/usr/lib/python3/dist-packages/pytest.py", line 13, in
from _pytest.fixtures import fixture, yield_fixture
File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 842, in
class FixtureFunctionMarker(object):
File "/usr/lib/python3/dist-packages/_pytest/fixtures.py", line 844, in FixtureFunctionMarker
params = attr.ib(convert=attr.converters.optional(tuple))
TypeError: attrib() got an unexpected keyword argument 'convert'

convert argument was removed from _pytest/fixtures.py since https://github.com/pytest-dev/pytest/pull/3228/files

tamhanepd commented 3 years ago

I updated attrs version to 20.3.0 and astropy version of pytest to 0.8.0 ( I think the earlier pytest-astropy version was 0.2.0 or something). Now the problem is resolved. Thank you for your help.