[py-dev] [hpk42/pytest] localized conftest not run (issue #198)
Jason R. Coombs
issues-reply at bitbucket.org
Fri Oct 5 14:31:09 CEST 2012
--- you can reply above this line ---
New issue 198: localized conftest not run
https://bitbucket.org/hpk42/pytest/issue/198/localized-conftest-not-run
Jason R. Coombs:
In the [[https://bitbucket.org/yougov/pmxbot|pmxbot project]], there is a pytest test suite, and within that test suite are two conftest.py files, one at tests/conftest.py and another at tests/unit/conftest.py.
{{{
PS C:\Users\jaraco\G\public\pmxbot> tree /f tests
│ conftest.py
│ __init__.py
│
├───functional
│ │ test_exceptions.py
│ │ test_logging.py
│ │ test_messages.py
│ │ test_rss.py
│ │ __init__.py
│ │
│ ...
│
└───unit
conftest.py
testconf.yaml
test_commands.py
test_karma.py
test_quotes.py
test_util.py
__init__.py
}}}
These tests run fine under pytest 2.2.4, but under 2.3.dev10 and 2.3.dev17, some tests fail. Specifically, the tests that depend on the funcarg as defined in [[/yougov/pmxbot/src/85020053dd0b/tests/unit/conftest.py|tests/unit/conftest.py]] will fail because the funcarg is not defined:
{{{
PS C:\Users\jaraco\G\public\pmxbot> py.test -k MongoDBKarma -x
============================= test session starts =============================
platform win32 -- Python 2.7.3 -- pytest-2.3.0.dev17 -- C:\Python\python.exe
collected 219 items
tests\unit\test_karma.py:21: TestMongoDBKarma.test_basic_usage ERROR
=================================== ERRORS ====================================
_____________ ERROR at setup of TestMongoDBKarma.test_basic_usage _____________
def test_basic_usage(self, mongodb_uri):
LookupError: no factory found for argument 'mongodb_uri'
available funcargs: pytestconfig, recwarn, monkeypatch, capfd, capsys, tmpdir
use 'py.test --funcargs [testpath]' for help on them.
C:\Users\jaraco\G\public\pmxbot\tests\unit\test_karma.py:21
!!!!!!!!!!!!!!!!!!! Interrupted: stopping after 1 failures !!!!!!!!!!!!!!!!!!!!
================== 215 tests deselected by '-kMongoDBKarma' ===================
=================== 215 deselected, 1 error in 4.49 seconds ===================
}}}
I read the changelog for changes between 2.2 and 2.3 and I didn't see anything that seemed to indicate that this pattern is no longer supported.
Can pytest support multiple, scoped conftest.py modules? I wanted to report this as it appears to be a regression from 2.2. The changelog should probably mention it (or if it already does, highlight the impact as I've described) if it is not supported. Do you have any other suggestions?
--
This is an issue notification from bitbucket.org. You are receiving
this either because you are the owner of the issue, or you are
following the issue.
More information about the Pytest-dev
mailing list