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

Using positional arg/dir outside of PWD does not load options from explicit plugin #1594

Closed
blueyed opened this issue Jun 7, 2016 · 2 comments

Comments

@blueyed
Copy link
Contributor

blueyed commented Jun 7, 2016

py.test -p project.lock8.plugin /tmp project --custom-option fails with

py.test: error: unrecognized arguments: --custom-option

The option is defined through pytest_addoption and parser.addoption therein.

Using an additional directory outside of $PWD seems to cause this.

I have tried using --confcutdir=$PWD, but it still did not work.

pytest 2.9.3.dev0 (current master).

@blueyed
Copy link
Contributor Author

blueyed commented Jun 14, 2016

Regarding the testmon issue I've noticed that it also happens with py.test -c setup.cfg --my-custom-option http://localhost:9001/, but not when using an equal sign with the option: py.test -c setup.cfg --my-custom-option=http://localhost:9001/.

Please note that using the -c setup.cfg option here triggers the testmon issue, although py.test uses the same inifile when not specifying it.

rootdir: /path/to/project, inifile: setup.cfg
plugins: xdist-1.15.dev9+ngba35a3d, testmon-0.8.2, mock-1.1, asyncio-0.4.1, catchlog-1.2.2, random-0.2, incremental-0.4.2, notifier-0.2, cov-2.2.1, profiling-1.1.1, pylama-7.0.9, django-2.9.
1, instafail-0.3.0, bpdb-0.1.4

The custom option is added in project/app/plugin.py, which is loaded via setup.cfg:

addopts = --reuse-db --tb=short --dc=Tester -ra -p project.app.plugin --nomigrations
def pytest_addoption(parser):
    parser.addoption('--my-custom-option', action='store', default=None, help='…')

@nicoddemus
Copy link
Member

Resolved in #1621

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

2 participants