@@ -771,9 +771,11 @@ def test_improper_input(self):
771771 self .assertRaises (UserWarning , self .module .warn , 'convert to error' )
772772
773773 def test_import_from_module (self ):
774- script = support .script_helper .make_script ('test_warnings_importer' ,
775- 'import test.test_warnings.data.import_warning' )
776- rc , out , err = assert_python_ok (script )
774+ with support .temp_dir () as script_dir :
775+ script = support .script_helper .make_script (script_dir ,
776+ 'test_warnings_importer' ,
777+ 'import test.test_warnings.data.import_warning' )
778+ rc , out , err = assert_python_ok (script )
777779 self .assertNotIn (b'UserWarning' , err )
778780
779781 def test_syntax_warning_for_compiler (self ):
@@ -794,6 +796,7 @@ def func(self):
794796 self .assertEqual (out , b'' )
795797 # Check that we got a SyntaxError.
796798 err = err .decode ()
799+ err = support .strip_ansi (err )
797800 self .assertIn ("""SyntaxError: "is" with 'int' literal. Did you mean "=="?""" , err )
798801 # Check that the filename in the traceback is correct.
799802 self .assertIn (os .path .basename (script_name ), err )
0 commit comments