Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

py.test -n <number of processes> => "py.test: error: unrecognized arguments: -n"

I am trying to distribute django tests to multiple processes to speed up test runs.

I am using py.test in a virtual environment.

My relevant versions are:

$ pip freeze | grep test
django-pytest==0.2.0
django-webtest==1.7.7
pytest==2.5.2
pytest-cov==1.6
pytest-django==2.6.2
pytest-xdist==1.10
scripttest==1.3

When I try the command:

$ py.test -n 4

I get the error:

usage: py.test [options] [file_or_dir] [file_or_dir] [...]
py.test: error: unrecognized arguments: -n

py.test traceconfig command shows:

$ py.test --traceconfig
PLUGIN registered: <_pytest.python.FixtureManager instance at 0x1091fd320>
===================================================== test session starts ======================================================
platform darwin -- Python 2.7.2 -- py-1.4.20 -- pytest-2.5.2 --     /Users/mike/virtualenvs/foodnet/bin/python
using: pytest-2.5.2 pylib-1.4.20
setuptools registered plugins:
pytest-cov-1.6 at /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/pytest_cov.pyc
pytest-django-2.6.2 at /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/pytest_django/plugin.pyc

active plugins:

cacheprovider       : -1
helpconfig          : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/helpconfig.pyc
pytestconfig        : <_pytest.config.Config object at 0x108da9d50>
runner              : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/runner.pyc
unittest            : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/unittest.pyc
xdist               : -1
assertion           : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/assertion/__init__.pyc
pastebin            : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/pastebin.pyc
skipping            : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/skipping.pyc
genscript           : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/genscript.pyc
session             : <Session 'src'>
tmpdir              : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/tmpdir.pyc
capture             : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/capture.pyc
terminalreporter    : <_pytest.terminal.TerminalReporter instance at 0x1091ebcf8>
cache               : -1
4442026896          : <_pytest.config.PytestPluginManager object at 0x108c3f390>
mark                : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/mark.pyc
terminal            : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/terminal.pyc
main                : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/main.pyc
nose                : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/nose.pyc
python              : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/python.pyc
recwarn             : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/recwarn.pyc
funcmanage          : <_pytest.python.FixtureManager instance at 0x1091fd320>
monkeypatch         : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/monkeypatch.pyc
resultlog           : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/resultlog.pyc
cov                 : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/pytest_cov.pyc
capturemanager      : <_pytest.capture.CaptureManager instance at 0x1091ed710>
django              : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/pytest_django/plugin.pyc
pep8                : -1
junitxml            : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/junitxml.pyc
doctest             : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/doctest.pyc
pdb                 : /Users/mike/virtualenvs/foodnet/lib/python2.7/site-packages/_pytest/pdb.pyc

plugins: cov, django

I notice that xdist plugin has a -1 next to it. Does this indicate an error from that plugin?

py.test --help does not list the xdist arguments

like image 956
user475443 Avatar asked Nov 11 '22 06:11

user475443


1 Answers

Figured out it was:

-p no:xdist 

in the addopts section in tox.ini. Removed it and xdist worked.

like image 148
user475443 Avatar answered Nov 14 '22 23:11

user475443