diff options
| author | Steven Knight <knight@baldmt.com> | 2003-02-26 17:40:22 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2003-02-26 17:40:22 (GMT) |
| commit | c98c5391f5afa134589db88ebe986368a1b6097f (patch) | |
| tree | 1a7e0f06222b16f346e09b1dcfc185e470fbd3e5 /src/engine/SCons/Node/FSTests.py | |
| parent | 8a816e6362b715a238183ae25551dbb6df7cddc3 (diff) | |
| download | SCons-c98c5391f5afa134589db88ebe986368a1b6097f.zip SCons-c98c5391f5afa134589db88ebe986368a1b6097f.tar.gz SCons-c98c5391f5afa134589db88ebe986368a1b6097f.tar.bz2 | |
Fix str(Node.FS) in an SConscript file, and add a separate src_dir argument to SConscript(). (Charles Crain)
Diffstat (limited to 'src/engine/SCons/Node/FSTests.py')
| -rw-r--r-- | src/engine/SCons/Node/FSTests.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 1e8bc92..5e4bb52 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -190,8 +190,8 @@ class BuildDirTestCase(unittest.TestCase): assert str(f1) == os.path.normpath('src/test.in'), str(f1) # Build path does not exist assert not f1.exists() - # But source path does - assert f1.srcnode().exists() + # ...but the actual file is not there... + assert not os.path.exists(f1.abspath) # And duplicate=0 should also work just like a Repository assert f1.rexists() # rfile() should point to the source path @@ -270,6 +270,16 @@ class BuildDirTestCase(unittest.TestCase): # Verify the Mkdir and Link actions are called f9 = fs.File('build/var2/new_dir/test9.out') + # Test for an interesting pathological case...we have a source + # file in a build path, but not in a source path. This can + # happen if you switch from duplicate=1 to duplicate=0, then + # delete a source file. At one time, this would cause exists() + # to return a 1 but get_contents() to throw. + test.write([ 'work', 'build', 'var1', 'asourcefile' ], 'stuff') + f10 = fs.File('build/var1/asourcefile') + assert f10.exists() + assert f10.get_contents() == 'stuff', f10.get_contents() + save_Mkdir = SCons.Node.FS.Mkdir dir_made = [] def mkdir_func(target, source, env, dir_made=dir_made): @@ -801,9 +811,11 @@ class FSTestCase(unittest.TestCase): fs = SCons.Node.FS.FS() assert str(fs.getcwd()) == ".", str(fs.getcwd()) fs.chdir(fs.Dir('subdir')) - assert str(fs.getcwd()) == "subdir", str(fs.getcwd()) + # The cwd's path is always "." + assert str(fs.getcwd()) == ".", str(fs.getcwd()) + assert fs.getcwd().path == 'subdir', fs.getcwd().path fs.chdir(fs.Dir('../..')) - assert str(fs.getcwd()) == test.workdir, str(fs.getcwd()) + assert fs.getcwd().path == test.workdir, fs.getcwd().path f1 = fs.File(test.workpath("do_i_exist")) assert not f1.exists() |
