Skip to content

Commit 39fec62

Browse files
committed
fixup
1 parent 09077a4 commit 39fec62

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

tests/support/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,14 @@ def is_path_within(path, start=None, _msg=None):
276276
return not relative.startswith('..')
277277

278278

279+
def _ensuredirs(absolute_dir):
280+
try:
281+
os.makedirs(absolute_dir)
282+
except OSError as oserr:
283+
if oserr.errno != errno.EEXIST:
284+
raise
285+
286+
279287
def fixturefile(relative_path, fixture_format=None, include_path=False):
280288
"""Support function for loading fixtures from their serialised format.
281289

tests/test_mig_cgibin_cat.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
import shutil
55
import sys
66

7-
from tests.support import MIG_BASE, MigTestCase, testmain, _temppath, \
8-
fixturefile, fixturefile_normname
7+
from tests.support import MIG_BASE, MigTestCase, testmain, \
8+
fixturefile, fixturefile_normname, \
9+
_ensuredirs, _temppath
910

1011
from mig.shared.base import client_id_dir
1112
from mig.shared.functionality.cat import _main as main
@@ -36,6 +37,7 @@ def before_each(self):
3637

3738
# ensure a user db with our test user
3839
db_home = self.configuration.user_db_home
40+
_ensuredirs(db_home)
3941
db_fixture, db_fixture_file = fixturefile('MiG-users.db--example', fixture_format='binary', include_path=True)
4042
test_db_file = _temppath(fixturefile_normname('MiG-users.db--example', prefix=db_home), self)
4143
shutil.copyfile(db_fixture_file, test_db_file)

0 commit comments

Comments
 (0)