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

Function test_tmp_path_fallback_tox_env

testing/test_tmpdir.py:170–183  ·  view source on GitHub ↗

Test that tmp_path works even if environment variables required by getpass module are missing (#1010).

(pytester: Pytester, monkeypatch)

Source from the content-addressed store, hash-verified

168
169
170def test_tmp_path_fallback_tox_env(pytester: Pytester, monkeypatch) -> None:
171 """Test that tmp_path works even if environment variables required by getpass
172 module are missing (#1010).
173 """
174 monkeypatch.delenv("USER", raising=False)
175 monkeypatch.delenv("USERNAME", raising=False)
176 pytester.makepyfile(
177 """
178 def test_some(tmp_path):
179 assert tmp_path.is_dir()
180 """
181 )
182 reprec = pytester.inline_run()
183 reprec.assertoutcome(passed=1)
184
185
186@pytest.fixture

Callers

nothing calls this directly

Calls 4

delenvMethod · 0.80
assertoutcomeMethod · 0.80
makepyfileMethod · 0.45
inline_runMethod · 0.45

Tested by

no test coverage detected