This side effect at module import time has a race condition between the "exists" check and the "mkdir" call. The safer thing is to just call mkdir and catch the "already exists" error which is what makedirs does.
TEST_DATA_ROOT_PATH = os.path.join(os.path.expanduser('~'), '.tvm_test_data')
-if not os.path.exists(TEST_DATA_ROOT_PATH):
- os.mkdir(TEST_DATA_ROOT_PATH)
+os.makedirs(TEST_DATA_ROOT_PATH, exist_ok=True)
+
def download_testdata(url, relpath, module=None):
"""Downloads the test data from the internet.