mirror of https://github.com/django/django.git
Fixed test failure on Windows.
os.close(fd) is needed to avoid "The process cannot access the file because it is being used by another process"
This commit is contained in:
parent
d47409831f
commit
c2ab501bab
|
@ -87,11 +87,12 @@ class TestFilenameGenerator(TestCase):
|
|||
self.assertFalse(any(f.endswith('.pyc') for f in gen_filenames()))
|
||||
|
||||
def test_deleted_removed(self):
|
||||
_, filepath = tempfile.mkstemp(dir=os.path.dirname(upath(__file__)), suffix='.py')
|
||||
fd, filepath = tempfile.mkstemp(dir=os.path.dirname(upath(__file__)), suffix='.py')
|
||||
try:
|
||||
_, filename = os.path.split(filepath)
|
||||
import_module('.%s' % filename.replace('.py', ''), package='utils_tests')
|
||||
self.assertIn(filepath, gen_filenames())
|
||||
finally:
|
||||
os.close(fd)
|
||||
os.remove(filepath)
|
||||
self.assertNotIn(filepath, gen_filenames())
|
||||
|
|
Loading…
Reference in New Issue