I am trying to run py.test
on my package but it is trying to parse setup.py
from the project root directory even if I tried to exclude it.
I need to collect the tests from *.py files because the test classes are included in the modules.
# setup.cfg
[pytest]
norecursedirs = .svn _build tmp* lib/third lib *.egg bin distutils setup.py
python_files = *.py
Still when I run py.test
it will give me ERROR collecting setup.py
which I already excluded.
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py:140: in setup
> raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg
E SystemExit: usage: py.test [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
E or: py.test --help [cmd1 cmd2 ...]
E or: py.test --help-commands
E or: py.test cmd --help
E
E error: no commands supplied
You can configure the --ignore option to your pytest.ini configuration like this maybe:
addopts = --ignore=setup.py
which should help if you are in the root directory and want py.test to ignore the setup.py file.
From the docs (and the name of the variable) it looks like norecursedirs
only skips directories, so since setup.py
is a file, putting it in norecursedirs
has no effect.
http://pytest.org/latest/customize.html?highlight=norecursedirs#confval-norecursedirs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With