MCPcopy
hub / github.com/pytest-dev/pytest / test_ignored_virtualenvs

Method test_ignored_virtualenvs

testing/test_collection.py:167–180  ·  view source on GitHub ↗
(self, pytester: Pytester, env_path: PurePath)

Source from the content-addressed store, hash-verified

165
166 @known_environment_types
167 def test_ignored_virtualenvs(self, pytester: Pytester, env_path: PurePath) -> None:
168 ensure_file(pytester.path / "virtual" / env_path)
169 testfile = ensure_file(pytester.path / "virtual" / "test_invenv.py")
170 testfile.write_text("def test_hello(): pass", encoding="utf-8")
171
172 # by default, ignore tests inside a virtualenv
173 result = pytester.runpytest()
174 result.stdout.no_fnmatch_line("*test_invenv*")
175 # allow test collection if user insists
176 result = pytester.runpytest("--collect-in-virtualenv")
177 assert "test_invenv" in result.stdout.str()
178 # allow test collection if user directly passes in the directory
179 result = pytester.runpytest("virtual")
180 assert "test_invenv" in result.stdout.str()
181
182 @known_environment_types
183 def test_ignored_virtualenvs_norecursedirs_precedence(

Callers

nothing calls this directly

Calls 5

ensure_fileFunction · 0.85
write_textMethod · 0.80
no_fnmatch_lineMethod · 0.80
strMethod · 0.80
runpytestMethod · 0.45

Tested by

no test coverage detected