Skip to content

CLI arguments are differently passed to workers (pytest 4.6.10) #533

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

Closed
dasm opened this issue May 14, 2020 · 4 comments
Closed

CLI arguments are differently passed to workers (pytest 4.6.10) #533

dasm opened this issue May 14, 2020 · 4 comments

Comments

@dasm
Copy link

dasm commented May 14, 2020

After update to pytest 4.6.10 (python2 version), pytest-xdist started misbehaving. I'm not sure yet what is the problem: pytest or pytest-xdist.

I can reproduce the same behavior for pytest 5.4.2, but downgrading to pytest 5.4.1 is not feasible - there is another error due to: INTERNALERROR> TypeError: unhashable type: 'ExceptionChainRepr'

For 4.6.9

(venv2) ➜  dcp-test-utils git:(master) ✗ pytest --iofs-framework=/storage/shared/home_directories/dsmigiel/apps/dcp-test-utils --sync-dir=/storage/shared/home_directories/dsmigiel/s10_darby_creek --workspace=/storage/shared/home_directories/dsmigiel/workspace -m 'iofs and
 centos7_el7 and single and not long_running' --tx ssh=sj-avl-d07-mc --tx ssh=sj-avl-d08-mc --tx ssh=sj-avl-d09-mc --tx ssh=sj-avl-d13-mc --tx ssh=sj-avl-r1-11 --tx ssh=sj-avl-r1-21 --tx ssh=sj-avl-r1-9 --skip-provisioning
============================================================================================================================= test session starts ==============================================================================================================================
platform darwin -- Python 2.7.17, pytest-4.6.9, py-1.8.1, pluggy-0.13.1
rootdir: /Users/dsmigiel/apps/dcp-test-utils, inifile: pytest.ini, testpaths: adapt_regtest
plugins: timeout-1.3.4, ansible-playbook-0.4.1, html-1.22.1, forked-1.1.3, xdist-1.32.0, cloud-4.0.0, metadata-1.8.0, json-report-1.2.1
timeout: 600.0s
timeout method: signal
timeout func_only: False
gw0 I / gw1 I / gw2 I / gw3 I / gw4 I / gw5 I / gw6 I

Skipping preconfiguration

gw0 [21] / gw1 [21] / gw2 [21] / gw3 [21] / gw4 [21] / gw5 [21] / gw6 [21]

For 4.6.10

(venv2) ➜  dcp-test-utils git:(master) ✗ pytest --iofs-framework=/storage/shared/home_directories/dsmigiel/apps/dcp-test-utils --sync-dir=/storage/shared/home_directories/dsmigiel/s10_darby_creek --workspace=/storage/shared/home_directories/dsmigiel/workspace -m 'iofs and centos7_el7 and single and not long_running' --tx ssh=sj-avl-d07-mc --tx ssh=sj-avl-d08-mc --tx ssh=sj-avl-d09-mc --tx ssh=sj-avl-d13-mc --tx ssh=sj-avl-r1-11 --tx ssh=sj-avl-r1-21 --tx ssh=sj-avl-r1-9 --skip-provisioning
============================================================================================================================= test session starts ==============================================================================================================================
platform darwin -- Python 2.7.17, pytest-4.6.10, py-1.8.1, pluggy-0.13.1
rootdir: /Users/dsmigiel/apps/dcp-test-utils, inifile: pytest.ini, testpaths: adapt_regtest
plugins: timeout-1.3.4, ansible-playbook-0.4.1, html-1.22.1, forked-1.1.3, xdist-1.32.0, cloud-4.0.0, metadata-1.8.0, json-report-1.2.1
timeout: 600.0s
timeout method: signal
timeout func_only: False
gw0 I / gw1 I / gw2 I / gw3 I / gw4 I / gw5 I / gw6 I

Skipping preconfiguration

gw0 [0] / gw1 [0] / gw2 [0] / gw3 [0] / gw4 [0] / gw5 [0] / gw6 [0]

--------------------------------------------------------------------------------------------------------------------------------- JSON report ----------------------------------------------------------------------------------------------------------------------------------
JSON report written to: report.json (1447 bytes)
=========================================================================================================================== short test summary info ============================================================================================================================
FAILED  - ValueError: option names set(['--workspace']) already added
FAILED  - ValueError: option names set(['--workspace']) already added
FAILED  - ValueError: option names set(['--workspace']) already added
FAILED  - ValueError: option names set(['--workspace']) already added
FAILED  - ValueError: option names set(['--workspace']) already added
FAILED  - ValueError: option names set(['--workspace']) already added
FAILED  - ValueError: option names set(['--workspace']) already added
@dasm
Copy link
Author

dasm commented May 14, 2020

I'm seeing it's a new feature: https://github.com/pytest-dev/pytest/pull/6870/files
I'm trying to understand how it's being used.

@dasm dasm changed the title CLI arguments are not passed to workers CLI arguments are not passed to workers (pytest 4.6.10) May 14, 2020
@dasm dasm changed the title CLI arguments are not passed to workers (pytest 4.6.10) CLI arguments are differently passed to workers (pytest 4.6.10) May 14, 2020
@dasm
Copy link
Author

dasm commented May 14, 2020

More digging around is showing, that it might be intended behavior: #491
#491

Still haven't figured how to use that.

@dasm
Copy link
Author

dasm commented May 14, 2020

_pytest/config/__init__.py:495: in _importconftest
    return self._conftestpath2mod[key]
E   KeyError: PosixPath('/storage/shared/home_directories/dsmigiel/pyexecnetcache/dcp-test-utils/conftest.py')

During handling of the above exception, another exception occurred:
py/_path/common.py:383: in visit
    for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
py/_path/common.py:424: in gen
    dirs = self.optsort([p for p in entries
py/_path/common.py:425: in <listcomp>
    if p.check(dir=1) and (rec is None or rec(p))])
_pytest/nodes.py:506: in _recurse
    ihook = self._gethookproxy(dirpath)
_pytest/nodes.py:487: in _gethookproxy
    my_conftestmodules = pm._getconftestmodules(fspath)
_pytest/config/__init__.py:473: in _getconftestmodules
    mod = self._importconftest(conftestpath)
_pytest/config/__init__.py:520: in _importconftest
    self.consider_conftest(mod)
_pytest/config/__init__.py:575: in consider_conftest
    self.register(conftestmodule, name=conftestmodule.__file__)
_pytest/config/__init__.py:379: in register
    ret = super().register(plugin, name)
/usr/local/lib/python3.6/site-packages/pluggy/manager.py:127: in register
    hook._maybe_apply_history(hookimpl)
/usr/local/lib/python3.6/site-packages/pluggy/hooks.py:333: in _maybe_apply_history
    res = self._hookexec(self, [method], kwargs)
/usr/local/lib/python3.6/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/local/lib/python3.6/site-packages/pluggy/manager.py:87: in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
dcp-test-utils/conftest.py:11: in pytest_addoption
    help="Default workspace to run test on remote host"
_pytest/config/argparsing.py:94: in addoption
    self._anonymous.addoption(*opts, **attrs)
_pytest/config/argparsing.py:353: in addoption
    raise ValueError("option names %s already added" % conflict)
E   ValueError: option names {'--workspace'} already added

@dasm
Copy link
Author

dasm commented May 14, 2020

The last error is connected to explicit 2 copies of conftest.py. I believe, I made some errors in the way how I scoped my tests.

@dasm dasm closed this as completed May 14, 2020
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

1 participant