Skip to content

DeprecationWarning triggered in _pytest.tmpdir use of attr #4507

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

Closed
johnthagen opened this issue Dec 5, 2018 · 4 comments
Closed

DeprecationWarning triggered in _pytest.tmpdir use of attr #4507

johnthagen opened this issue Dec 5, 2018 · 4 comments
Assignees
Labels
good first issue easy issue that is friendly to new contributor plugin: tmpdir related to the tmpdir builtin plugin type: refactoring internal improvements to the code

Comments

@johnthagen
Copy link

This line:

convert=attr.converters.optional(

Uses a deprecated feature of attr:

https://github.com/python-attrs/attrs/blob/6a3458f2c22dcdbe6d6eac51b60b8a006447e85d/src/attr/_make.py#L187

 warnings.warn(
            "The `convert` argument is deprecated in favor of `converter`.  "
            "It will be removed after 2019/01.",
            DeprecationWarning,
            stacklevel=2,
        )

You can see this being triggered when running with -Werror and suppressing pytest's other DeprecationWarning (#1403).

https://travis-ci.org/johnthagen/python-blueprint/jobs/462520895

$ python --version Python 3.7.1 $ pip --version pip 18.1 from /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/pip (python 3.7) install 1.07s$ pip install tox Collecting tox Downloading https://files.pythonhosted.org/packages/d0/43/2160a300e0b77a929a980f36ac7427dcef8f4ddac7a8c21e5a8baedad828/tox-3.5.3-py2.py3-none-any.whl (53kB) 100% |████████████████████████████████| 61kB 2.6MB/s Requirement already satisfied: setuptools>=30.0.0 in /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages (from tox) (40.5.0) Requirement already satisfied: py<2,>=1.4.17 in /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages (from tox) (1.7.0) Collecting filelock<4,>=3.0.0 (from tox) Downloading https://files.pythonhosted.org/packages/d7/ca/3c74396a9ed8a4cfab5459800edeef9a1269591cb21f5a49bd71a49c5fa2/filelock-3.0.10-py3-none-any.whl Requirement already satisfied: six<2,>=1.0.0 in /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages (from tox) (1.11.0) Requirement already satisfied: pluggy<1,>=0.3.0 in /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages (from tox) (0.8.0) Requirement already satisfied: virtualenv>=1.11.2 in /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages (from tox) (16.1.0) Collecting toml>=0.9.4 (from tox) Downloading https://files.pythonhosted.org/packages/a2/12/ced7105d2de62fa7c8fb5fce92cc4ce66b57c95fb875e9318dba7f8c5db0/toml-0.10.0-py2.py3-none-any.whl Installing collected packages: filelock, toml, tox Successfully installed filelock-3.0.10 toml-0.10.0 tox-3.5.3 16.00s$ tox GLOB sdist-make: /home/travis/build/johnthagen/python-blueprint/setup.py py37 create: /home/travis/build/johnthagen/python-blueprint/.tox/py37 py37 installdeps: -rrequirements.txt, -rdev-requirements.txt py37 inst: /home/travis/build/johnthagen/python-blueprint/.tox/.tmp/package/1/fact-1.0.0.zip py37 installed: alabaster==0.7.12,atomicwrites==1.2.1,attrs==18.2.0,Babel==2.6.0,certifi==2018.11.29,chardet==3.0.4,colorama==0.4.1,coverage==4.5.2,docutils==0.14,exitstatus==1.3.0,fact==1.0.0,flake8==3.6.0,flake8-import-order==0.18,flake8-polyfill==1.0.2,flake8-quotes==1.0.0,idna==2.7,imagesize==1.1.0,Jinja2==2.10,MarkupSafe==1.1.0,mccabe==0.6.1,more-itertools==4.3.0,packaging==18.0,pep8-naming==0.7.0,pluggy==0.8.0,py==1.7.0,pycodestyle==2.4.0,pyflakes==2.0.0,Pygments==2.3.0,pyparsing==2.3.0,pytest==4.0.1,pytest-cov==2.6.0,pytz==2018.7,requests==2.20.1,six==1.11.0,snowballstemmer==1.2.1,Sphinx==1.8.2,sphinxcontrib-websupport==1.1.0,urllib3==1.24.1 py37 run-test-pre: PYTHONHASHSEED='455988851' py37 runtests: commands[0] | python -bb -Werror -Wignore:::_pytest.assertion.rewrite -m pytest --cov=fact --cov-report=html Traceback (most recent call last): File "/opt/python/3.7.1/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/opt/python/3.7.1/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/travis/build/johnthagen/python-blueprint/.tox/py37/lib/python3.7/site-packages/pytest.py", line 91, in raise SystemExit(pytest.main()) File "/home/travis/build/johnthagen/python-blueprint/.tox/py37/lib/python3.7/site-packages/_pytest/config/__init__.py", line 58, in main config = _prepareconfig(args, plugins) File "/home/travis/build/johnthagen/python-blueprint/.tox/py37/lib/python3.7/site-packages/_pytest/config/__init__.py", line 182, in _prepareconfig config = get_config() File "/home/travis/build/johnthagen/python-blueprint/.tox/py37/lib/python3.7/site-packages/_pytest/config/__init__.py", line 153, in get_config pluginmanager.import_plugin(spec) File "/home/travis/build/johnthagen/python-blueprint/.tox/py37/lib/python3.7/site-packages/_pytest/config/__init__.py", line 522, in import_plugin __import__(importspec) File "/home/travis/build/johnthagen/python-blueprint/.tox/py37/lib/python3.7/site-packages/_pytest/tmpdir.py", line 25, in class TempPathFactory(object): File "/home/travis/build/johnthagen/python-blueprint/.tox/py37/lib/python3.7/site-packages/_pytest/tmpdir.py", line 35, in TempPathFactory lambda p: Path(os.path.abspath(six.text_type(p))) File "/home/travis/build/johnthagen/python-blueprint/.tox/py37/lib/python3.7/site-packages/attr/_make.py", line 191, in attrib stacklevel=2, DeprecationWarning: The `convert` argument is deprecated in favor of `converter`. It will be removed after 2019/01. ERROR: InvocationError for command '/home/travis/build/johnthagen/python-blueprint/.tox/py37/bin/python -bb -Werror -Wignore:::_pytest.assertion.rewrite -m pytest --cov=fact --cov-report=html' (exited with code 1) ___________________________________ summary ____________________________________ ERROR: py37: commands failed The command "tox" exited with 1. ```

This would be great to fix so that users could more easily run pytest with -Werror and catch warnings in their own code.

@Zac-HD Zac-HD added good first issue easy issue that is friendly to new contributor type: refactoring internal improvements to the code plugin: tmpdir related to the tmpdir builtin plugin labels Dec 5, 2018
@RonnyPfannschmidt RonnyPfannschmidt self-assigned this Dec 5, 2018
RonnyPfannschmidt added a commit to RonnyPfannschmidt/pytest that referenced this issue Dec 5, 2018
@RonnyPfannschmidt
Copy link
Member

#4510

@Zac-HD
Copy link
Member

Zac-HD commented Jul 18, 2019

Closed by #4795 😄

@Zac-HD Zac-HD closed this as completed Jul 18, 2019
@johnthagen
Copy link
Author

Related:

  File "/home/gitlab-runner/builds/DwvLisya/0/.tox/py36/lib/python3.6/site-packages/_pytest/mark/structures.py", line 370, in <module>
    @attr.s(cmp=False, hash=False)
  File "/home/gitlab-runner/builds/DwvLisya/0/.tox/py36/lib/python3.6/site-packages/attr/_make.py", line 944, in attrs
    eq, order = _determine_eq_order(cmp, eq, order)
  File "/home/gitlab-runner/builds/DwvLisya/0/.tox/py36/lib/python3.6/site-packages/attr/_make.py", line 750, in _determine_eq_order
    warnings.warn(_CMP_DEPRECATION, DeprecationWarning, stacklevel=3)
DeprecationWarning: The usage of `cmp` is deprecated and will be removed on or after 2021-06-01.

@RonnyPfannschmidt
Copy link
Member

New issue please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue easy issue that is friendly to new contributor plugin: tmpdir related to the tmpdir builtin plugin type: refactoring internal improvements to the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants