File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44from io import StringIO
55import sys
66import unittest
7- import shutil
87import tempfile
98import subprocess
109from test import support
@@ -678,12 +677,11 @@ def test_issue_8766(self):
678677 # "import encodings" emits a warning whereas the warnings is not loaded
679678 # or not completly loaded (warnings imports indirectly encodings by
680679 # importing linecache) yet
681- old_cwd = os . getcwd ()
680+ cwd = tempfile . mkdtemp ()
682681 try :
683- cwd = tempfile .mkdtemp ()
682+ encodings = os .path .join (cwd , 'encodings' )
683+ os .mkdir (encodings )
684684 try :
685- os .chdir (cwd )
686- os .mkdir ('encodings' )
687685 env = os .environ .copy ()
688686 env ['PYTHONPATH' ] = cwd
689687
@@ -697,9 +695,9 @@ def test_issue_8766(self):
697695 env = env )
698696 self .assertEqual (retcode , 0 )
699697 finally :
700- shutil . rmtree ( cwd )
698+ os . rmdir ( encodings )
701699 finally :
702- os .chdir ( old_cwd )
700+ os .rmdir ( cwd )
703701
704702def test_main ():
705703 py_warnings .onceregistry .clear ()
You can’t perform that action at this time.
0 commit comments