mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Passed strict=True to Path.resolve() to enforce that the path must exist.
This commit is contained in:
committed by
Carlton Gibson
parent
b991eefd3a
commit
edeec1247e
@@ -35,7 +35,7 @@ class TestIterModulesAndFiles(SimpleTestCase):
|
||||
def assertFileFound(self, filename):
|
||||
# Some temp directories are symlinks. Python resolves these fully while
|
||||
# importing.
|
||||
resolved_filename = filename.resolve()
|
||||
resolved_filename = filename.resolve(strict=True)
|
||||
self.clear_autoreload_caches()
|
||||
# Test uncached access
|
||||
self.assertIn(resolved_filename, list(autoreload.iter_all_python_module_files()))
|
||||
@@ -44,7 +44,7 @@ class TestIterModulesAndFiles(SimpleTestCase):
|
||||
self.assertEqual(autoreload.iter_modules_and_files.cache_info().hits, 1)
|
||||
|
||||
def assertFileNotFound(self, filename):
|
||||
resolved_filename = filename.resolve()
|
||||
resolved_filename = filename.resolve(strict=True)
|
||||
self.clear_autoreload_caches()
|
||||
# Test uncached access
|
||||
self.assertNotIn(resolved_filename, list(autoreload.iter_all_python_module_files()))
|
||||
@@ -168,7 +168,7 @@ class TestCommonRoots(SimpleTestCase):
|
||||
class TestSysPathDirectories(SimpleTestCase):
|
||||
def setUp(self):
|
||||
self._directory = tempfile.TemporaryDirectory()
|
||||
self.directory = Path(self._directory.name).resolve().absolute()
|
||||
self.directory = Path(self._directory.name).resolve(strict=True).absolute()
|
||||
self.file = self.directory / 'test'
|
||||
self.file.touch()
|
||||
|
||||
@@ -381,7 +381,7 @@ class ReloaderTests(SimpleTestCase):
|
||||
|
||||
def setUp(self):
|
||||
self._tempdir = tempfile.TemporaryDirectory()
|
||||
self.tempdir = Path(self._tempdir.name).resolve().absolute()
|
||||
self.tempdir = Path(self._tempdir.name).resolve(strict=True).absolute()
|
||||
self.existing_file = self.ensure_file(self.tempdir / 'test.py')
|
||||
self.nonexistent_file = (self.tempdir / 'does_not_exist.py').absolute()
|
||||
self.reloader = self.RELOADER_CLS()
|
||||
|
||||
Reference in New Issue
Block a user