diff options
| author | Steven Knight <knight@baldmt.com> | 2002-11-30 05:30:47 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2002-11-30 05:30:47 (GMT) |
| commit | 454239b699f5b3b81ef3b10aa3e97361eadbf5f4 (patch) | |
| tree | f7bba81881c008f2968f589842544d2a68854d01 /src/engine/SCons/Node/FSTests.py | |
| parent | 4e5b73e5e77664749549fc5082550f82c4064604 (diff) | |
| download | SCons-454239b699f5b3b81ef3b10aa3e97361eadbf5f4.zip SCons-454239b699f5b3b81ef3b10aa3e97361eadbf5f4.tar.gz SCons-454239b699f5b3b81ef3b10aa3e97361eadbf5f4.tar.bz2 | |
Really take care of non-existent drive letters on Win32.
Diffstat (limited to 'src/engine/SCons/Node/FSTests.py')
| -rw-r--r-- | src/engine/SCons/Node/FSTests.py | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 5d32873..8386f83 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -31,7 +31,7 @@ import time import unittest import SCons.Node.FS from TestCmd import TestCmd -from SCons.Errors import UserError +import SCons.Errors import stat built_it = None @@ -255,7 +255,7 @@ class BuildDirTestCase(unittest.TestCase): try: fs = SCons.Node.FS.FS() fs.BuildDir('build', '/test/foo') - except UserError: + except SCons.Errors.UserError: exc_caught = 1 assert exc_caught, "Should have caught a UserError." @@ -263,7 +263,7 @@ class BuildDirTestCase(unittest.TestCase): try: fs = SCons.Node.FS.FS() fs.BuildDir('build', 'build/src') - except UserError: + except SCons.Errors.UserError: exc_caught = 1 assert exc_caught, "Should have caught a UserError." @@ -604,7 +604,7 @@ class FSTestCase(unittest.TestCase): def nonexistent(method, s): try: x = method(s, create = 0) - except UserError: + except SCons.Errors.UserError: pass else: raise TestFailed, "did not catch expected UserError" @@ -923,7 +923,27 @@ class StringDirTestCase(unittest.TestCase): f = fs.File('file', 'sub') assert str(f) == os.path.join('sub', 'file') assert not f.exists() - + +class prepareTestCase(unittest.TestCase): + def runTest(self): + """Test the prepare() method""" + + class MyFile(SCons.Node.FS.File): + def _createDir(self): + raise SCons.Errors.StopError + def exists(self): + return None + + fs = SCons.Node.FS.FS() + file = MyFile('foo', fs.Dir('.'), fs) + + exc_caught = 0 + try: + file.prepare() + except SCons.Errors.StopError: + exc_caught = 1 + assert exc_caught, "Should have caught a StopError." + if __name__ == "__main__": suite = unittest.TestSuite() @@ -932,5 +952,6 @@ if __name__ == "__main__": suite.addTest(RepositoryTestCase()) suite.addTest(find_fileTestCase()) suite.addTest(StringDirTestCase()) + suite.addTest(prepareTestCase()) if not unittest.TextTestRunner().run(suite).wasSuccessful(): sys.exit(1) |
