Commit 78ec5204 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test] Setup a proper test prefix

parent d36d57f0
Pipeline #17295 passed with stage
in 11 minutes and 2 seconds
......@@ -30,29 +30,32 @@
import os
import sys
import subprocess
import shutil
import tempfile
import pkg_resources
import logging
from ..utils import Prefix
prefix = Prefix([
pkg_resources.resource_filename(__name__, 'prefix'),
pkg_resources.resource_filename('beat.backend.python.test', 'prefix'),
])
if sys.platform == 'darwin':
tmp_prefix = tempfile.mkdtemp(prefix=__name__, suffix='.tmpdir', dir='/tmp')
tmp_prefix = tempfile.mkdtemp(prefix=__name__,
suffix='.tmpdir',
dir='/tmp')
prefix_folder = tempfile.mkdtemp(prefix=__name__,
suffix='.prefix',
dir='/tmp')
else:
tmp_prefix = tempfile.mkdtemp(prefix=__name__, suffix='.tmpdir')
tmp_prefix = tempfile.mkdtemp(prefix=__name__,
suffix='.tmpdir')
prefix_folder = tempfile.mkdtemp(prefix=__name__,
suffix='.prefix')
prefix = os.path.join(prefix_folder, 'prefix')
# Setup the logging system
if False:
formatter = logging.Formatter(fmt="[%(asctime)s - TESTS - " \
formatter = logging.Formatter(fmt="[%(asctime)s - TESTS - "
"%(name)s] %(levelname)s: %(message)s",
datefmt="%d/%b/%Y %H:%M:%S")
......@@ -68,10 +71,18 @@ if False:
beat_backend_logger.addHandler(handler)
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:
subprocess.check_call(['rsync', '-arz', path, prefix_folder])
def teardown_package():
if os.path.exists(tmp_prefix):
shutil.rmtree(tmp_prefix)
if os.path.exists(os.path.join(prefix.paths[0], '.beat')):
shutil.rmtree(os.path.join(prefix.paths[0], '.beat'))
shutil.rmtree(prefix_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