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 throws warning (Unknown config option: collect_ignore) #608

Closed
geozeke opened this issue Oct 18, 2020 · 5 comments
Closed

pytest throws warning (Unknown config option: collect_ignore) #608

geozeke opened this issue Oct 18, 2020 · 5 comments

Comments

@geozeke
Copy link

geozeke commented Oct 18, 2020

This package is fantastic! Thank you so much for all the hard work on it.

  • Date you used Cookiecutter PyPackage: 10/18/20
  • Cookiecutter version used, if any: 1.7.2
  • Python version, if any: 3.8.5
  • Operating System: Ubuntu 20.04

Description

When attempting to run make test, pytest throws a warning. It appears to have trouble with this section in setup.cfg:

[tool:pytest]
collect_ignore = ['setup.py']

Which is curious, because collect_ignore is an environment variable called out in the pytest documentation.

What I Did

Ran a test on my project with: make test

(pydev) ➜  mypackage make test                      
pytest
============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-6.1.1, py-1.9.0, pluggy-0.13.1
rootdir: /home/----/shares/Repos/mypackage, configfile: setup.cfg
collected 11 items                                                             

tests/test_mypackage.py ...........                                      [100%]

=============================== warnings summary ===============================
../pydev/lib/python3.8/site-packages/_pytest/config/__init__.py:1230
  /home/----/shares/Repos/pydev/lib/python3.8/site-packages/_pytest/config/__init__.py:1230: PytestConfigWarning: Unknown config option: collect_ignore
  
    self._warn_or_fail_if_strict("Unknown config option: {}\n".format(key))

-- Docs: https://docs.pytest.org/en/stable/warnings.html
======================== 11 passed, 1 warning in 0.55s =========================
(pydev) ➜  mypackage 

@cauliyang
Copy link

I meet the same issue!

@genzj
Copy link

genzj commented Jan 10, 2021

Here is a workaround. Just remove the collect_ignore from setup.cfg and specify it via cli args instead, e.g. pytest --ignore=setup.py

@lene
Copy link

lene commented Jan 13, 2021

Same issue here with Python 3.8.6, pytest-6.2.1

@sbliven
Copy link

sbliven commented Mar 5, 2021

Yep, this seems to have been removed from pytest. The setup.cfg template should be adjusted.

sbliven added a commit to sbliven/cookiecutter-pypackage-noir that referenced this issue Mar 5, 2021
- add black formatting
- add mypy check
- Add python 3.9 options
- customize github_url
- Move all requirement lists to setup.py
- fix audreyfeldroy#608 (pytest doesn't support collect_ignore option)
@dcmoura
Copy link

dcmoura commented Aug 17, 2021

Workaround:

Remove the collect_ignore entry.
Add command line options to pytest using addopts:

[tool:pytest]
addopts = --ignore=setup.py

6uhrmittag added a commit to 6uhrmittag/taskbutler that referenced this issue Sep 13, 2021
- rename test
- remove order mark
- remove assert_exitcode from test_cli_main_basic because config.ini doesn't exist in CI
- fix Warning PytestConfigWarning: Unknown config option: collect_ignore" (audreyfeldroy/cookiecutter-pypackage#608)
6uhrmittag added a commit to 6uhrmittag/taskbutler that referenced this issue Sep 13, 2021
- rename test
- remove order mark
- remove assert_exitcode from test_cli_main_basic because config.ini doesn't exist in CI
- fix Warning PytestConfigWarning: Unknown config option: collect_ignore" (audreyfeldroy/cookiecutter-pypackage#608)
amano-takahisa added a commit to amano-takahisa/tagstr that referenced this issue Oct 24, 2021
@geozeke geozeke closed this as completed Jun 25, 2022
zouzias added a commit to zouzias/cookiecutter-pypackage that referenced this issue Aug 22, 2022
observingClouds added a commit to observingClouds/xbitinfo that referenced this issue Oct 5, 2022
observingClouds added a commit to observingClouds/xbitinfo that referenced this issue Oct 6, 2022
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

7 participants
@sbliven @lene @genzj @dcmoura @geozeke @cauliyang and others