summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Blevins <wblevins001@gmail.com>2016-09-23 00:43:00 -0400
committerWilliam Blevins <wblevins001@gmail.com>2016-09-23 00:43:00 -0400
commiteb8a1e84f775e6fa46f71ec17a33ac51b35f94da (patch)
tree5e1e05b0b5b5bfe42d57614f635c199ff70d9dc6
parent332cc0180e1ef06142b898b881ee69c1259397d5 (diff)
downloadscons-eb8a1e84f775e6fa46f71ec17a33ac51b35f94da.tar.gz
Allowed for multiple fixture dirs and added default global directory.
-rw-r--r--QMTest/TestCmd.py25
-rw-r--r--QMTest/TestSCons.py2
-rwxr-xr-xruntest.py8
3 files changed, 22 insertions, 13 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py
index bff0d6aa..109c83a0 100644
--- a/QMTest/TestCmd.py
+++ b/QMTest/TestCmd.py
@@ -924,7 +924,7 @@ class TestCmd(object):
self.condition = 'no_result'
self.workdir_set(workdir)
self.subdir(subdir)
- self.script_srcdir = None
+ self.fixture_dirs = []
def __del__(self):
self.cleanup()
@@ -1248,8 +1248,13 @@ class TestCmd(object):
assumed to be under the temporary working directory, it gets
created automatically, if it does not already exist.
"""
- if srcdir and self.script_srcdir and not os.path.isabs(srcdir):
- spath = os.path.join(self.script_srcdir, srcdir)
+
+ if srcdir and self.fixture_dirs and not os.path.isabs(srcdir):
+ for dir in self.fixture_dirs:
+ spath = os.path.join(self.fixture_dirs, srcdir)
+ if os.path.isdir(spath):
+ continue
+
else:
spath = srcdir
if dstdir:
@@ -1285,13 +1290,15 @@ class TestCmd(object):
automatically, if it does not already exist.
"""
srcpath, srctail = os.path.split(srcfile)
- if srcpath:
- if self.script_srcdir and not os.path.isabs(srcpath):
- spath = os.path.join(self.script_srcdir, srcfile)
- else:
- spath = srcfile
+
+ if srcpath and (not self.fixture_dirs or os.path.isabs(srcpath)):
+ spath = srcfile
else:
- spath = os.path.join(self.script_srcdir, srcfile)
+ for dir in self.fixture_dirs:
+ spath = os.path.join(self.fixture_dirs, srcfile)
+ if os.path.isfile(spath):
+ continue
+
if not dstfile:
if srctail:
dpath = os.path.join(self.workdir, srctail)
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py
index 0d5dc901..f02ddd8b 100644
--- a/QMTest/TestSCons.py
+++ b/QMTest/TestSCons.py
@@ -268,7 +268,7 @@ class TestSCons(TestCommon):
SCons.Node.FS.default_fs = SCons.Node.FS.FS()
try:
- self.script_srcdir = os.environ['PYTHON_SCRIPT_DIR']
+ self.fixture_dirs = os.environ['FIXTURE_DIRS'].split(':')
except KeyError:
pass
diff --git a/runtest.py b/runtest.py
index 0950bbe7..dec8f9f6 100755
--- a/runtest.py
+++ b/runtest.py
@@ -786,10 +786,12 @@ def run_test(t, io_lock, async=True):
if not suppress_stdout and not suppress_stderr:
sys.stdout.write(header)
head, tail = os.path.split(t.abspath)
+ fixture_dirs = []
if head:
- os.environ['PYTHON_SCRIPT_DIR'] = head
- else:
- os.environ['PYTHON_SCRIPT_DIR'] = ''
+ fixture_dirs.append(head)
+ fixture_dirs.append(os.path.join(os.path.split(os.path.abspath(__file__))[0], 'fixture'))
+ os.environ['PYTHON_SCRIPT_DIR'] = ':'.join(fixture_dirs)
+
test_start_time = time_func()
if execute_tests:
t.execute()