From: stevenknight Date: Mon, 30 Aug 2004 05:04:22 +0000 (+0000) Subject: Test fixes: Win32 portability in Delete.py; fix a problem in msvs.py introduced... X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d9aaef45f7c749553c6998ee96d72c509112dcdb;p=scons.git Test fixes: Win32 portability in Delete.py; fix a problem in msvs.py introduced by quoting Python executables; clean up temporary files/directories properly in SConfTests.py and UtilTests.py. git-svn-id: http://scons.tigris.org/svn/scons/trunk@1047 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py index 9b3f2a62..f9c144c3 100644 --- a/src/engine/SCons/SConfTests.py +++ b/src/engine/SCons/SConfTests.py @@ -160,6 +160,7 @@ class SConfTestCase(unittest.TestCase): self.name = name self.state = None self.side_effects = [] + self.builder = None def has_builder(self): return 1 def add_pre_action(self, *actions): @@ -180,9 +181,22 @@ class SConfTestCase(unittest.TestCase): pass def clear(self): pass + def current(self, calc=None): + return None + def prepare(self): + pass + def retrieve_from_cache(self): + return 0 + def build(self, **kw): + return + def built(self): + pass return [MyNode('n1'), MyNode('n2')] - self.scons_env.Append(BUILDERS = {'SConfActionBuilder' : MyBuilder()}) - sconf.TryBuild(self.scons_env.SConfActionBuilder) + try: + self.scons_env.Append(BUILDERS = {'SConfActionBuilder' : MyBuilder()}) + sconf.TryBuild(self.scons_env.SConfActionBuilder) + finally: + sconf.Finish() def test_TryCompile(self): """Test SConf.TryCompile diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py index 0cda4614..52f56a71 100644 --- a/src/engine/SCons/UtilTests.py +++ b/src/engine/SCons/UtilTests.py @@ -1252,8 +1252,14 @@ class UtilTestCase(unittest.TestCase): import tempfile filename = tempfile.mktemp() str = '1234567890 ' + filename - open(filename, 'w').write(str) - assert open(get_native_path(filename)).read() == str + try: + open(filename, 'w').write(str) + assert open(get_native_path(filename)).read() == str + finally: + try: + os.unlink(filename) + except OSError: + pass def test_subst_dict(self): """Test substituting dictionary values in an Action diff --git a/test/Delete.py b/test/Delete.py index c57a810f..138dc950 100644 --- a/test/Delete.py +++ b/test/Delete.py @@ -161,6 +161,8 @@ test.write('f14.in', "f14.in\n") test.run(status=2, stderr=None) -test.fail_test(string.find(test.stderr(), "No such file or directory") == -1) +stderr = test.stderr() +test.fail_test(string.find(stderr, "No such file or directory") == -1 and + string.find(stderr, "The system cannot find the path specified") == -1) test.pass_test() diff --git a/test/msvs.py b/test/msvs.py index fb419059..9dfd6f71 100644 --- a/test/msvs.py +++ b/test/msvs.py @@ -68,8 +68,8 @@ CFG=Test - Win32 Release # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "" # PROP BASE Intermediate_Dir "" -# PROP BASE Cmd_Line " -c "" -C -f SConstruct \Test.exe" -# PROP BASE Rebuild_Opt "-c && -c "" -C -f SConstruct \Test.exe" +# PROP BASE Cmd_Line """ -c "" -C -f SConstruct \Test.exe" +# PROP BASE Rebuild_Opt "-c && "" -c "" -C -f SConstruct \Test.exe" # PROP BASE Target_File "\Test.exe" # PROP BASE Bsc_Name "" # PROP BASE Target_Dir "" @@ -77,8 +77,8 @@ CFG=Test - Win32 Release # PROP Use_Debug_Libraries 0 # PROP Output_Dir "" # PROP Intermediate_Dir "" -# PROP Cmd_Line " -c "" -C -f SConstruct \Test.exe" -# PROP Rebuild_Opt "-c && -c "" -C -f SConstruct \Test.exe" +# PROP Cmd_Line """ -c "" -C -f SConstruct \Test.exe" +# PROP Rebuild_Opt "-c && "" -c "" -C -f SConstruct \Test.exe" # PROP Target_File "\Test.exe" # PROP Bsc_Name "" # PROP Target_Dir ""