Commit 42431df3 authored by Samuel GAIST's avatar Samuel GAIST

[tests] Generate a temporary test prefix

This will rsync prefixes of all needed packages in one place in
order to provide a single prefix like on development or production
setup.

This will allow the removal of the use of the Prefix class that was
mainly use only in tests.
parent edf5512a
......@@ -28,10 +28,15 @@
# Basic setup for command test
import os
import sys
import tempfile
import shutil
import subprocess
import pkg_resources
import six.moves.urllib as urllib
from beat.core.test import prefix, tmp_prefix, teardown_package
from beat.core.test import tmp_prefix, teardown_package
platform = os.environ.get('BEAT_CMDLINE_TEST_PLATFORM', '')
......@@ -65,3 +70,29 @@ else:
user = 'user'
token = '4'
if sys.platform == 'darwin':
tmp_folder = tempfile.mkdtemp(prefix=__name__, suffix='.tmpdir', dir='/tmp')
else:
tmp_folder = tempfile.mkdtemp(prefix=__name__, suffix='.tmpdir')
prefix = os.path.join(tmp_folder, 'prefix')
def rsync_to_tmp(path):
subprocess.check_call(['rsync', '-arz', path, tmp_folder])
def setup_package():
prefixes = [
pkg_resources.resource_filename('beat.backend.python.test', 'prefix'),
pkg_resources.resource_filename('beat.core.test', 'prefix')
]
for path in prefixes:
rsync_to_tmp(path)
def teardown_package():
shutil.rmtree(tmp_folder)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment