summaryrefslogtreecommitdiffstats
path: root/test/D
diff options
context:
space:
mode:
authorRussel Winder <russel@winder.org.uk>2014-09-06 14:38:18 (GMT)
committerRussel Winder <russel@winder.org.uk>2014-09-06 14:38:18 (GMT)
commit414cb583cf31b2a8c65704e57dd19cfb865e6582 (patch)
treed9df738c9e6ec8dc70680fe37ec2428702481f09 /test/D
parentea1898b916bbaceab6ecff490b51606ba0b311dc (diff)
downloadSCons-414cb583cf31b2a8c65704e57dd19cfb865e6582.zip
SCons-414cb583cf31b2a8c65704e57dd19cfb865e6582.tar.gz
SCons-414cb583cf31b2a8c65704e57dd19cfb865e6582.tar.bz2
Amend the executable search support function to use the default SCons path only.
Diffstat (limited to 'test/D')
-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 e0487f6..17d9990 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()