def test_force_remove_file(self): with tempfile.NamedTemporaryFile(delete=False) as fp: pass assert os.path.exists(fp.name) os_ext.force_remove_file(fp.name) assert not os.path.exists(fp.name) # Try to remove a non-existent file os_ext.force_remove_file(fp.name)
def test_force_remove_file(tmp_path): fp = tmp_path / 'tmp_file' fp.touch() fp_name = str(fp) assert os.path.exists(fp_name) os_ext.force_remove_file(fp_name) assert not os.path.exists(fp_name) # Try to remove a non-existent file os_ext.force_remove_file(fp_name)
def tearDown(self): os_ext.rmtree(self.prefix) os_ext.rmtree(self.perflogdir, ignore_errors=True) os_ext.force_remove_file(self.logfile)