From 61bcb77878e7137ceb2881f5b22c8127f5738629 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Sat, 20 Sep 2008 13:41:57 +0000 Subject: Windows test fix: enhance the TestSCons class so an explicit python=None argument still defaults to sys.executable. Use this to reset the python value we interpolate into the expected files that we generate after resetting the os.environ['PYTHON'] value. --- QMTest/TestSCons.py | 5 ++++- test/MSVS/vs-7.0-files.py | 4 ++-- test/MSVS/vs-7.1-files.py | 4 ++-- test/MSVS/vs-8.0-files.py | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index e14f8f4..2ef393c 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -757,7 +757,7 @@ print "self._msvs_versions =", str(env['MSVS']['VERSIONS']) def msvs_substitute(self, input, msvs_ver, subdir=None, sconscript=None, - python=sys.executable, + python=None, project_guid=None): if not hasattr(self, '_msvs_versions'): self.msvs_versions() @@ -770,6 +770,9 @@ print "self._msvs_versions =", str(env['MSVS']['VERSIONS']) if sconscript is None: sconscript = self.workpath('SConstruct') + if python is None: + python = sys.executable + if project_guid is None: project_guid = "{E5466E26-0003-F18B-8F8A-BCD76C86388D}" diff --git a/test/MSVS/vs-7.0-files.py b/test/MSVS/vs-7.0-files.py index 2535514..f00de51 100644 --- a/test/MSVS/vs-7.0-files.py +++ b/test/MSVS/vs-7.0-files.py @@ -203,11 +203,10 @@ test.must_not_exist(test.workpath('work1', 'Test.sln')) # Test that running SCons with $PYTHON_ROOT in the environment # changes the .vcproj output as expected. os.environ['PYTHON_ROOT'] = 'xyzzy' +python = os.path.join('$(PYTHON_ROOT)', os.path.split(TestSCons.python)[1]) test.run(chdir='work1', arguments='Test.vcproj') -python = os.path.join('$(PYTHON_ROOT)', os.path.split(TestSCons.python)[1]) - test.must_exist(test.workpath('work1', 'Test.vcproj')) vcproj = test.read(['work1', 'Test.vcproj'], 'r') expect = test.msvs_substitute(expected_vcprojfile, '7.0', 'work1', 'SConstruct', @@ -216,6 +215,7 @@ expect = test.msvs_substitute(expected_vcprojfile, '7.0', 'work1', 'SConstruct', assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) os.environ['PYTHON_ROOT'] = '' +python = None diff --git a/test/MSVS/vs-7.1-files.py b/test/MSVS/vs-7.1-files.py index 578943d..8c9821c 100644 --- a/test/MSVS/vs-7.1-files.py +++ b/test/MSVS/vs-7.1-files.py @@ -205,11 +205,10 @@ test.must_not_exist(test.workpath('work1', 'Test.sln')) # Test that running SCons with $PYTHON_ROOT in the environment # changes the .vcproj output as expected. os.environ['PYTHON_ROOT'] = 'xyzzy' +python = os.path.join('$(PYTHON_ROOT)', os.path.split(TestSCons.python)[1]) test.run(chdir='work1', arguments='Test.vcproj') -python = os.path.join('$(PYTHON_ROOT)', os.path.split(TestSCons.python)[1]) - test.must_exist(test.workpath('work1', 'Test.vcproj')) vcproj = test.read(['work1', 'Test.vcproj'], 'r') expect = test.msvs_substitute(expected_vcprojfile, '7.1', 'work1', 'SConstruct', @@ -218,6 +217,7 @@ expect = test.msvs_substitute(expected_vcprojfile, '7.1', 'work1', 'SConstruct', assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) os.environ['PYTHON_ROOT'] = '' +python = None diff --git a/test/MSVS/vs-8.0-files.py b/test/MSVS/vs-8.0-files.py index 33eefd5..40daa57 100644 --- a/test/MSVS/vs-8.0-files.py +++ b/test/MSVS/vs-8.0-files.py @@ -212,11 +212,10 @@ test.must_not_exist(test.workpath('work1', 'Test.sln')) # Test that running SCons with $PYTHON_ROOT in the environment # changes the .vcproj output as expected. os.environ['PYTHON_ROOT'] = 'xyzzy' +python = os.path.join('$(PYTHON_ROOT)', os.path.split(TestSCons.python)[1]) test.run(chdir='work1', arguments='Test.vcproj') -python = os.path.join('$(PYTHON_ROOT)', os.path.split(TestSCons.python)[1]) - test.must_exist(test.workpath('work1', 'Test.vcproj')) vcproj = test.read(['work1', 'Test.vcproj'], 'r') expect = test.msvs_substitute(expected_vcprojfile, '8.0', 'work1', 'SConstruct', @@ -225,6 +224,7 @@ expect = test.msvs_substitute(expected_vcprojfile, '8.0', 'work1', 'SConstruct', assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj) os.environ['PYTHON_ROOT'] = '' +python = None -- cgit v0.12