summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussel Winder <russel@winder.org.uk>2014-09-06 15:38:18 +0100
committerRussel Winder <russel@winder.org.uk>2014-09-06 15:38:18 +0100
commitd82d4dad709020c8acb2760c6a238cf6874903a9 (patch)
treed9df738c9e6ec8dc70680fe37ec2428702481f09
parent2a59857d462bb4c77a00482573277c203ec1326b (diff)
downloadscons-d82d4dad709020c8acb2760c6a238cf6874903a9.tar.gz
Amend the executable search support function to use the default SCons path only.
-rwxr-xr-xtest/D/Support/executablesSearch.py37
1 files changed, 29 insertions, 8 deletions
diff --git a/test/D/Support/executablesSearch.py b/test/D/Support/executablesSearch.py
index e0487f6c..17d99907 100755
--- a/test/D/Support/executablesSearch.py
+++ b/test/D/Support/executablesSearch.py
@@ -29,39 +29,60 @@ Support functions for all the tests.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+if __name__ == '__main__':
+ import sys
+ import os.path
+ sys.path.append(os.path.abspath('../../../src/engine'))
+
+from SCons.Environment import Base
+
+path = Base()['ENV']['PATH']
+
def isExecutableOfToolAvailable(test, tool):
for executable in {
'dmd': ['dmd', 'gdmd'],
'gdc': ['gdc'],
- 'ldc': ['ldc2', 'ldc']}[tool]:
- if test.where_is(executable):
+ 'ldc': ['ldc2', 'ldc'],
+ }[tool]:
+ if test.where_is(executable, path):
return True
return False
+
if __name__ == '__main__':
import unittest
- import sys
- import os.path
sys.path.append(os.path.abspath('../../../QMTest'))
- sys.path.append(os.path.abspath('../../../src/engine'))
+
import TestSCons
class VariousTests(unittest.TestCase):
+ '''
+ These tests are somewhat self referential in that
+ isExecutableOfToolAvailable uses where_is to do most of it's
+ work and we use the same function in the tests.
+ '''
def setUp(self):
self.test = TestSCons.TestSCons()
+
+ def tearDown(self):
+ self.test = None
+
def test_None_tool(self):
self.assertRaises(KeyError, isExecutableOfToolAvailable, self.test, None)
+
def test_dmd_tool(self):
self.assertEqual(
- self.test.where_is('dmd') is not None or self.test.where_is('gdmd') is not None,
+ self.test.where_is('dmd', path) is not None or self.test.where_is('gdmd', path) is not None,
isExecutableOfToolAvailable(self.test, 'dmd'))
+
def test_gdc_tool(self):
self.assertEqual(
- self.test.where_is('gdc') is not None,
+ self.test.where_is('gdc', path) is not None,
isExecutableOfToolAvailable(self.test, 'gdc'))
+
def test_ldc_tool(self):
self.assertEqual(
- self.test.where_is('ldc2') is not None or self.test.where_is('ldc') is not None,
+ self.test.where_is('ldc2', path) is not None or self.test.where_is('ldc', path) is not None,
isExecutableOfToolAvailable(self.test, 'ldc'))
unittest.main()