mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
test_classes: Fix data import path reuse parallelism errors.
The make_import_output_dir helper function used a path determined primarily by the filename of the fixture being used, and expected to have complete control over that path for the duration of the test. This resulted in nondeterministic errors if our two test classes that ran Mattermost import code ran at the same time.
This commit is contained in:
@@ -63,6 +63,7 @@ import re
|
||||
import ujson
|
||||
import urllib
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
API_KEYS = {} # type: Dict[str, str]
|
||||
|
||||
@@ -692,8 +693,8 @@ class ZulipTestCase(TestCase):
|
||||
shutil.rmtree(path)
|
||||
|
||||
def make_import_output_dir(self, exported_from: str) -> str:
|
||||
output_dir = "var/test-{}-import".format(exported_from)
|
||||
self.rm_tree(output_dir)
|
||||
output_dir = tempfile.mkdtemp(dir="var/",
|
||||
prefix="test-" + exported_from + "-import-")
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
return output_dir
|
||||
|
||||
|
||||
Reference in New Issue
Block a user