File tree 2 files changed +5
-5
lines changed
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ def prepare(self) -> None:
90
90
This needs to happen before any importing, and without importing anything.
91
91
"""
92
92
path0 : Optional [str ]
93
- if os .environ .get ('PYTHONSAFEPATH' , '' ):
93
+ if env . PYVERSION >= ( 3 , 11 ) and os .environ .get ('PYTHONSAFEPATH' , '' ):
94
94
# See https://docs.python.org/3/using/cmdline.html#cmdoption-P
95
95
path0 = None
96
96
elif self .as_module :
Original file line number Diff line number Diff line change 13
13
import py_compile
14
14
import re
15
15
import sys
16
- from unittest import mock
16
+ from pathlib import Path
17
17
from typing import Any , Iterator
18
18
19
19
import pytest
@@ -307,9 +307,9 @@ def test_pkg1_init(self) -> None:
307
307
assert out == "pkg1.__init__: pkg1\n pkg1.__init__: __main__\n "
308
308
assert err == ""
309
309
310
- def test_pythonpath (self , tmp_path ) -> None :
311
- env = { "PYTHONSAFEPATH" : "1" }
312
- with mock . patch . dict ( os . environ , env ), change_dir (tmp_path ):
310
+ def test_pythonpath (self , tmp_path : Path ) -> None :
311
+ self . set_environ ( "PYTHONSAFEPATH" , "1" )
312
+ with change_dir (tmp_path ):
313
313
run_python_module (["process_test.try_execfile" ])
314
314
out , err = self .stdouterr ()
315
315
mod_globs = json .loads (out )
You can’t perform that action at this time.
0 commit comments