Generated: Wed 2013-03-13 10:33 CET
Source file: /media/Envs/Envs/filer-gallery/lib/python2.7/site-packages/cms/test_utils/tmpdir.py
Stats: 0 executed, 15 missed, 6 excluded, 5 ignored
# -*- coding: utf-8 -*-from contextlib import contextmanagerfrom tempfile import mkdtempimport osimport randomimport shutilimport stat@contextmanagerdef 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()