Commit e436b779 authored by Jérome Perrin's avatar Jérome Perrin

testing/testcase: only snapshot if requested

Once testnodes are updated and always set SLAPOS_TEST_LOG_DIRECTORY, we
no longer need to have a default case of creating a snapshot folder
automatically, which was causing difficulties when running tests locally
as we had to remove this folder manually between test executions.
parent d46012f6
......@@ -33,6 +33,7 @@ import re
import glob
import logging
import shutil
import warnings
from six.moves.urllib.parse import urlparse
try:
......@@ -124,8 +125,6 @@ def makeModuleSetUpAndTestCaseClass(
'base directory ( {} ) is too deep, try setting '
'SLAPOS_TEST_WORKING_DIR to a shallow enough directory'.format(
base_directory))
if not snapshot_directory:
snapshot_directory = os.path.join(base_directory, "snapshots")
cls = type(
'SlapOSInstanceTestCase for {}'.format(software_url),
......@@ -589,6 +588,9 @@ class SlapOSInstanceTestCase(unittest.TestCase):
The path are made relative to slapos root directory and
we keep the same directory structure.
"""
if not cls._test_file_snapshot_directory:
warnings.warn("No snapshot directory configured, skipping snapshot")
return
# we cannot use os.path.commonpath on python2, so implement something similar
common_path = os.path.commonprefix((source_file_name, cls._base_directory))
if not os.path.isdir(common_path):
......
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