New issue 436: Presence of --junitxml junit.xml option and existence of junit.xml file causes conftest.py not to be loaded https://bitbucket.org/hpk42/pytest/issue/436/presence-of-junitxml-junitxml-option-and
Marc Abramowitz: Maybe or maybe not related to https://bitbucket.org/hpk42/pytest/issue/416/option-added-in-conftestpy-not-available, which uses a very similar example ("runslow) in fact. ``` $ pip freeze | grep pytest pytest==2.5.2 $ tree . └── tests ├── conftest.py └── test_stuff.py 1 directory, 2 files $ cat tests/conftest.py import pytest def pytest_addoption(parser): parser.addoption("--runslow", action="store_true", help="run slow tests") print("*** Added --runslow option") def pytest_runtest_setup(item): print("*** value of --runslow option: %r" % item.config.getoption("--runslow")) $ cat tests/test_stuff.py def test_stuff(): assert 1 + 1 == 2 ``` Now... The first time that I run `py.test` with `--junitxml junit.xml` and `-k test_stuff` and there is no `junit.xml` file yet, it works fine: ``` $ py.test --junitxml junit.xml --runslow -s -k test_stuff *** Added --runslow option ============================================================================= test session starts ============================================================================== platform darwin -- Python 2.7.6 -- py-1.4.20 -- pytest-2.5.2 collected 1 items tests/test_stuff.py *** value of --runslow option: True . ------------------------------------------------------------ generated xml file: /Users/marca/pytest-bug/junit.xml ------------------------------------------------------------- =========================================================================== 1 passed in 0.01 seconds =========================================================================== ``` Now that `junit.xml` exists: ``` $ ls -l junit.xml -rw-r--r-- 1 marca staff 215B Jan 30 16:06 junit.xml ``` A second invocation fails: ``` $ py.test --junitxml junit.xml --runslow -s -k test_stuff usage: py.test [options] [file_or_dir] [file_or_dir] [...] py.test: error: unrecognized arguments: --runslow ``` If I remove `--junitxml junit.xml`, it doesn't exhibit the problem: ``` $ py.test --runslow -s -k test_stuff *** Added --runslow option ============================================================================= test session starts ============================================================================== platform darwin -- Python 2.7.6 -- py-1.4.20 -- pytest-2.5.2 collected 1 items tests/test_stuff.py *** value of --runslow option: True . =========================================================================== 1 passed in 0.01 seconds =========================================================================== ``` It also goes away if I specify the `tests/` directory: ``` $ py.test --junitxml junit.xml --runslow -s -k test_stuff tests/ *** Added --runslow option ============================================================================= test session starts ============================================================================== platform darwin -- Python 2.7.6 -- py-1.4.20 -- pytest-2.5.2 collected 1 items tests/test_stuff.py *** value of --runslow option: True . ------------------------------------------------------------ generated xml file: /Users/marca/pytest-bug/junit.xml ------------------------------------------------------------- =========================================================================== 1 passed in 0.01 seconds =========================================================================== ``` I can't figure out what is going on here... _______________________________________________ pytest-commit mailing list pytest-commit@python.org https://mail.python.org/mailman/listinfo/pytest-commit