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

Function test_basetemp_with_read_only_files

testing/test_tmpdir.py:410–428  ·  view source on GitHub ↗

Integration test for #5524

(pytester: Pytester)

Source from the content-addressed store, hash-verified

408
409
410def test_basetemp_with_read_only_files(pytester: Pytester) -> None:
411 """Integration test for #5524"""
412 pytester.makepyfile(
413 """
414 import os
415 import stat
416
417 def test(tmp_path):
418 fn = tmp_path / 'foo.txt'
419 fn.write_text('hello')
420 mode = os.stat(str(fn)).st_mode
421 os.chmod(str(fn), mode & ~stat.S_IREAD)
422 """
423 )
424 result = pytester.runpytest("--basetemp=tmp")
425 assert result.ret == 0
426 # running a second time and ensure we don't crash
427 result = pytester.runpytest("--basetemp=tmp")
428 assert result.ret == 0
429
430
431def test_tmp_path_factory_handles_invalid_dir_characters(

Callers

nothing calls this directly

Calls 2

makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected