forked from ungleich-public/dynamicweb
clone cms with menus, make menus standalone app
This commit is contained in:
parent
1ece5ce7c7
commit
afb096b7a3
1153 changed files with 318897 additions and 37 deletions
26
cms/test_utils/tmpdir.py
Normal file
26
cms/test_utils/tmpdir.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import os
|
||||
import random
|
||||
import shutil
|
||||
import stat
|
||||
from contextlib import contextmanager
|
||||
from tempfile import mkdtemp
|
||||
|
||||
|
||||
@contextmanager
|
||||
def temp_dir():
|
||||
name = make_temp_dir()
|
||||
yield name
|
||||
shutil.rmtree(name)
|
||||
|
||||
|
||||
def make_temp_dir():
|
||||
if os.path.exists('/dev/shm/'):
|
||||
if os.stat('/dev/shm').st_mode & stat.S_IWGRP:
|
||||
dirname = 'django-cms-tests-%s' % random.randint(1, 1000000)
|
||||
path = os.path.join('/dev/shm', dirname)
|
||||
while os.path.exists(path):
|
||||
dirname = 'django-cms-tests-%s' % random.randint(1, 1000000)
|
||||
path = os.path.join('/dev/shm', dirname)
|
||||
os.mkdir(path)
|
||||
return path
|
||||
return mkdtemp()
|
||||
Loading…
Add table
Add a link
Reference in a new issue