Skip to content

Commit 2a16ce2

Browse files
committed
Failing test for issue pytest-dev#2148.
1 parent 3164062 commit 2a16ce2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

testing/test_config.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,29 @@ def test_toolongargs_issue224(testdir):
527527
result = testdir.runpytest("-m", "hello" * 500)
528528
assert result.ret == EXIT_NOTESTSCOLLECTED
529529

530+
def test_config_in_subdirectory_colon_command_line_issue2148(testdir):
531+
conftest_source = '''
532+
def pytest_addoption(parser):
533+
parser.addini('foo', 'foo')
534+
'''
535+
536+
testdir.makefile('.ini', **{
537+
'pytest': '[pytest]\nfoo = root',
538+
'subdir/pytest': '[pytest]\nfoo = subdir',
539+
})
540+
541+
testdir.makepyfile(**{
542+
'conftest': conftest_source,
543+
'subdir/conftest': conftest_source,
544+
'subdir/test_foo': '''
545+
def test_foo(pytestconfig):
546+
assert pytestconfig.getini('foo') == 'subdir'
547+
'''})
548+
549+
result = testdir.runpytest('subdir/test_foo.py::test_foo')
550+
assert result.ret == 0
551+
552+
530553
def test_notify_exception(testdir, capfd):
531554
config = testdir.parseconfig()
532555
excinfo = pytest.raises(ValueError, "raise ValueError(1)")

0 commit comments

Comments
 (0)