@@ -46,28 +46,22 @@ def test_simple_about_command_line_can_run(self):
4646 def test_return_path_is_not_abspath_and_contains_subdirs_on_file (self ):
4747 # Using a relative path for the purpose of this test
4848 test_input = "about_code_tool/tests/testdata/thirdparty/django_snippets_2413.ABOUT"
49- test_output = join (TESTDATA_PATH , 'output/test_return_path_is_not_abspath_on_file.csv' )
50- try :
51- os .remove (test_output )
52- except OSError :
53- pass
49+ test_path = tempfile .NamedTemporaryFile (suffix = '.csv' , delete = True )
50+ test_output = test_path .name
51+ test_path .close ()
5452 collector = about .AboutCollector (test_input , 0 )
5553 collector .write_to_csv (test_output )
5654 self .assertTrue (open (test_output ).read ().partition ('\n ' )[2 ].startswith ('about_code_tool/tests/testdata/thirdparty/django_snippets_2413.ABOUT' ))
57- os .remove (test_output )
5855
5956 def test_return_path_is_not_abspath_and_contains_subdirs_on_dir (self ):
6057 # Using a relative path for the purpose of this test
6158 test_input = "about_code_tool/tests/testdata/basic"
62- test_output = join (TESTDATA_PATH , 'output/test_return_path_is_not_abspath_on_dir.csv' )
63- try :
64- os .remove (test_output )
65- except OSError :
66- pass
59+ test_path = tempfile .NamedTemporaryFile (suffix = '.csv' , delete = True )
60+ test_output = test_path .name
61+ test_path .close ()
6762 collector = about .AboutCollector (test_input , 0 )
6863 collector .write_to_csv (test_output )
6964 self .assertTrue (open (test_output ).read ().partition ('\n ' )[2 ].startswith ('about_code_tool/tests/testdata/basic' ))
70- os .remove (test_output )
7165
7266 def test_isvalid_about_file (self ):
7367 self .assertTrue (about .isvalid_about_file ("test.About" ))
0 commit comments