Fixed admin_scripts test failures on macOS.

Regression in 487d904bf2.
This commit is contained in:
Carlton Gibson 2019-02-14 14:28:19 +01:00 committed by GitHub
parent cf826c9a91
commit ed7dee55a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -42,7 +42,9 @@ class AdminScriptTestCase(SimpleTestCase):
def setUp(self): def setUp(self):
tmpdir = tempfile.TemporaryDirectory() tmpdir = tempfile.TemporaryDirectory()
self.addCleanup(tmpdir.cleanup) self.addCleanup(tmpdir.cleanup)
self.test_dir = os.path.join(tmpdir.name, 'test_project') # os.path.realpath() is required for temporary directories on macOS,
# where `/var` is a symlink to `/private/var`.
self.test_dir = os.path.realpath(os.path.join(tmpdir.name, 'test_project'))
os.mkdir(self.test_dir) os.mkdir(self.test_dir)
with open(os.path.join(self.test_dir, '__init__.py'), 'w'): with open(os.path.join(self.test_dir, '__init__.py'), 'w'):
pass pass