MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test__in_venv

Method test__in_venv

testing/test_collection.py:213–223  ·  view source on GitHub ↗

Directly test the virtual env detection function

(self, pytester: Pytester, fname: str)

Source from the content-addressed store, hash-verified

211 ),
212 )
213 def test__in_venv(self, pytester: Pytester, fname: str) -> None:
214 """Directly test the virtual env detection function"""
215 bindir = "Scripts" if sys.platform.startswith("win") else "bin"
216 # no bin/activate, not a virtualenv
217 base_path = pytester.mkdir("venv")
218 assert _in_venv(base_path) is False
219 # with bin/activate, totally a virtualenv
220 bin_path = base_path.joinpath(bindir)
221 bin_path.mkdir()
222 bin_path.joinpath(fname).touch()
223 assert _in_venv(base_path) is True
224
225 def test_custom_norecursedirs(self, pytester: Pytester) -> None:
226 pytester.makeini(

Callers

nothing calls this directly

Calls 2

_in_venvFunction · 0.90
mkdirMethod · 0.45

Tested by

no test coverage detected