diff --git a/run-tests.sh b/run-tests.sh index fb374372..e61fb3cb 100644 --- a/run-tests.sh +++ b/run-tests.sh @@ -11,7 +11,10 @@ fi RAM_DISK="/media/ramdisk" export RAM_DISK -sudo mkdir -p "$RAM_DISK" -sudo mount -t tmpfs -o size=2048M tmpfs "$RAM_DISK" +if [[ "$CI" ]]; then + sudo mkdir -p "$RAM_DISK" + sudo mount -t tmpfs -o size=2048M tmpfs "$RAM_DISK" +fi + pytest -n 8 tests -m "$TEST_SUITE" \ No newline at end of file diff --git a/tests/test_pipenv.py b/tests/test_pipenv.py index 8efb4c19..c4b22693 100644 --- a/tests/test_pipenv.py +++ b/tests/test_pipenv.py @@ -27,14 +27,6 @@ os.environ['PIPENV_DONT_USE_PYENV'] = '1' os.environ['PIPENV_IGNORE_VIRTUALENVS'] = '1' os.environ['PYPI_VENDOR_DIR'] = os.path.sep.join([os.path.dirname(__file__), 'pypi']) -from flask import Flask - -class PYPI(object): - """docstring for PYPI""" - def __init__(self, packages=None): - super(PYPI, self).__init__() - self.packages = packages or [] - @pytest.fixture(scope='module') def pip_src_dir(request): @@ -48,13 +40,23 @@ def pip_src_dir(request): return request +def ram_disk_or_tempdir(): + import uuid + if 'RAM_DISK' in os.environ: + name = uuid.uuid4().hex + dir_name = os.path.sep.join([os.environ['RAM_DISK'], name]) + os.mkdir(dir_name) + return dir_name + else: + return TemporaryDirectory(suffix='project', prefix='pipenv') + class PipenvInstance(): """An instance of a Pipenv Project...""" def __init__(self, pypi=None, pipfile=True, chdir=False): self.pypi = pypi self.original_umask = os.umask(0o007) self.original_dir = os.path.abspath(os.curdir) - self._path = TemporaryDirectory(suffix='project', prefix='pipenv') + self._path = ram_disk_or_tempdir() self.path = self._path.name # set file creation perms self.pipfile_path = None