File tree Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ Daniel Hahler
7070Daniel Nuri
7171Daniel Wandschneider
7272Danielle Jenkins
73+ Daniil Galiev
7374Dave Hunt
7475David Díaz-Barquero
7576David Mohr
Original file line number Diff line number Diff line change 1+ Fix incorrect discovery of non-test ``__init__.py `` files.
Original file line number Diff line number Diff line change 1+ Revert "The first test in a package (``__init__.py ``) marked with ``@pytest.mark.skip `` is now correctly skipped.".
Original file line number Diff line number Diff line change @@ -1257,3 +1257,24 @@ def test_collector_respects_tbstyle(testdir):
12571257 "*= 1 error in *" ,
12581258 ]
12591259 )
1260+
1261+
1262+ def test_does_not_eagerly_collect_packages (testdir ):
1263+ testdir .makepyfile ("def test(): pass" )
1264+ pydir = testdir .mkpydir ("foopkg" )
1265+ pydir .join ("__init__.py" ).write ("assert False" )
1266+ result = testdir .runpytest ()
1267+ assert result .ret == ExitCode .OK
1268+
1269+
1270+ def test_does_not_put_src_on_path (testdir ):
1271+ # `src` is not on sys.path so it should not be importable
1272+ testdir .tmpdir .join ("src/nope/__init__.py" ).ensure ()
1273+ testdir .makepyfile (
1274+ "import pytest\n "
1275+ "def test():\n "
1276+ " with pytest.raises(ImportError):\n "
1277+ " import nope\n "
1278+ )
1279+ result = testdir .runpytest ()
1280+ assert result .ret == ExitCode .OK
You can’t perform that action at this time.
0 commit comments