Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest uses deprecated convert argument in attr's attrib #3280

Closed
dchudz opened this issue Mar 4, 2018 · 11 comments
Closed

pytest uses deprecated convert argument in attr's attrib #3280

dchudz opened this issue Mar 4, 2018 · 11 comments

Comments

@dchudz
Copy link
Contributor

dchudz commented Mar 4, 2018

I checked this with pytest 3.4.1 and master (3.4.2.dev42+ge980fbbe):

$PYTHONWARNINGS="error::DeprecationWarning,default::DeprecationWarning:_pytest.assertion.rewrite" python -m pytest
/Users/davidchudzicki/.virtualenvs/pytest_convert_repro/lib/python3.6/site-packages/_pytest/assertion/rewrite.py:6: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/davidchudzicki/.virtualenvs/pytest_convert_repro/lib/python3.6/site-packages/pytest.py", line 13, in <module>
    from _pytest.fixtures import fixture, yield_fixture
  File "/Users/davidchudzicki/.virtualenvs/pytest_convert_repro/lib/python3.6/site-packages/_pytest/fixtures.py", line 840, in <module>
    class FixtureFunctionMarker(object):
  File "/Users/davidchudzicki/.virtualenvs/pytest_convert_repro/lib/python3.6/site-packages/_pytest/fixtures.py", line 842, in FixtureFunctionMarker
    params = attr.ib(convert=attr.converters.optional(tuple))
  File "/Users/davidchudzicki/.virtualenvs/pytest_convert_repro/lib/python3.6/site-packages/attr/_make.py", line 153, in attrib
    DeprecationWarning, stacklevel=2
DeprecationWarning: The `convert` argument is deprecated in favor of `converter`.  It will be removed after 2019/01.

(That second bit of PYTHONWARNINGS is to avoid #1403.)

This is in a fresh virtualenv after pip install pytest:

$pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
attrs (17.4.0)
more-itertools (4.1.0)
pip (9.0.1)
pluggy (0.6.0)
py (1.5.2)
pytest (3.4.1)
setuptools (38.5.1)
six (1.11.0)
wheel (0.30.0)
$python --version
Python 3.6.4

$sw_vers
ProductName:	Mac OS X
ProductVersion:	10.12.4
BuildVersion:	16E195

For context on why I care: I contribute to another project that's turning on "deprecation warnings as errors" in our CI. It's not so hard for us to special-case ignore this warning, but I thought I should mention it here.

@RonnyPfannschmidt
Copy link
Member

thanks for the note, this has been fixed in #3228 and will be released in the next feature release
we cant fix it in the patch release due to the shift in dependencies needed to correctly do this change in a minimal fashion

@dchudz
Copy link
Contributor Author

dchudz commented Mar 4, 2018

Thanks @RonnyPfannschmidt!

@Zac-HD
Copy link
Member

Zac-HD commented Mar 22, 2018

@RonnyPfannschmidt - any idea when the next feature release will be? If it's a long way off, I have a four-line shim that would fix this without a dependency bump.

@nicoddemus
Copy link
Member

nicoddemus commented Mar 22, 2018

@Zac-HD #3327 is open, so we should release in a few hours. 👍

@rohansb
Copy link

rohansb commented Oct 1, 2019

seeing this issue pop-up now on pytest==4.1.1 on python:3.5.7

@Zac-HD
Copy link
Member

Zac-HD commented Oct 1, 2019

Update your pytest then!

sgillies added a commit to rasterio/rasterio-wheels that referenced this issue Oct 1, 2019
@geraldoandradee
Copy link

Works perfectly on python==3.6.8 and pytest==5.2.0. Update the pytest version to solve the problem.

@rohansb
Copy link

rohansb commented Oct 2, 2019

thanks @geraldoandradee @Zac-HD doing the upgrade anyhow,
yet i was curious as to why an old version would break at this point, are you also indicating i should not be surprised?

airshipbot pushed a commit to airshipit/shipyard that referenced this issue Oct 2, 2019
- Pytest reference [0]
- amqp reference [1]

[0] pytest-dev/pytest#3280
[1] celery/kombu@b51d1d6

Change-Id: I676f54abf27e27646ae9ded4f1c2648824b047c9
tomato42 added a commit to tlsfuzzer/tlslite-ng that referenced this issue Oct 2, 2019
tomato42 added a commit to tlsfuzzer/tlslite-ng that referenced this issue Oct 2, 2019
tomato42 added a commit to tlsfuzzer/tlslite-ng that referenced this issue Oct 2, 2019
@geraldoandradee
Copy link

thanks @geraldoandradee @Zac-HD doing the upgrade anyhow,
yet i was curious as to why an old version would break at this point, are you also indicating i should not be surprised?

I was surprised, dude, believe me. This is the first time I ever saw this. But since this issue first happened in 2018, it seems to be an old issue. Kind of a bummer.

@leon-barrett
Copy link

@rohansb It looks to me like attrs==19.2.0 caused this to break. I also experienced this (on an old project using pytest==4.0.1), and pinning attrs==19.1.0 fixed this error for me.

@jbhannah
Copy link

jbhannah commented Oct 3, 2019

@leon-barrett I just ran into this same issue and pinning attrs==19.1.0 fixed it for me as well.

pckroon pushed a commit to pckroon/hypothesis that referenced this issue Oct 9, 2019
This is done because we now use Node.get_closes_marker, which is
introduced in pytest 4.1. However, we can't use 4.1 or 4.2 since those
don't play well with attrs==19.2.0. See also pytest-dev/pytest#3280
kmkurn added a commit to kmkurn/text2array that referenced this issue Oct 15, 2019
Because idk why using pytest 4.1.1 suddenly yields an error
like here: pytest-dev/pytest#3280.
mvaled added a commit to merchise/xotl.tools that referenced this issue Oct 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants