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

Projects

None yet

2 participants

@blueyed
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
Contributor
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='')
@blueyed blueyed referenced this issue Jun 25, 2016
Merged

Fix determining rootdir from common_ancestor #1621

0 of 6 tasks complete
@nicoddemus
Member

Resolved in #1621

@nicoddemus nicoddemus closed this Aug 6, 2016
This was referenced Aug 19, 2016
This was referenced Nov 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment