summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Node/FSTests.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2008-12-30 23:15:49 (GMT)
committerSteven Knight <knight@baldmt.com>2008-12-30 23:15:49 (GMT)
commitcc05c121706797a7708d135ce20ff40039111fa7 (patch)
treed31e1021d742e862be3124f1fdafc7249822f61c /src/engine/SCons/Node/FSTests.py
parent312f88d4f0daa0aa8ccdad202c76b7e297b605cd (diff)
downloadSCons-cc05c121706797a7708d135ce20ff40039111fa7.zip
SCons-cc05c121706797a7708d135ce20ff40039111fa7.tar.gz
SCons-cc05c121706797a7708d135ce20ff40039111fa7.tar.bz2
Allow subclassing of File and Dir nodes by having the must_be_same()
method check for isinstance(), not an exact class match.
Diffstat (limited to 'src/engine/SCons/Node/FSTests.py')
-rw-r--r--src/engine/SCons/Node/FSTests.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index 424aa5e..37dc465 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -1691,6 +1691,13 @@ class DirTestCase(_tempdirTestCase):
assert a[0] == 'pre', a
assert a[2] == 'post', a
+ def test_subclass(self):
+ """Test looking up subclass of Dir nodes"""
+ class DirSubclass(SCons.Node.FS.Dir):
+ pass
+ sd = self.fs._lookup('special_dir', None, DirSubclass, create=1)
+ sd.must_be_same(SCons.Node.FS.Dir)
+
def test_get_env_scanner(self):
"""Test the Dir.get_env_scanner() method
"""
@@ -2109,6 +2116,13 @@ class EntryTestCase(_tempdirTestCase):
class FileTestCase(_tempdirTestCase):
+ def test_subclass(self):
+ """Test looking up subclass of File nodes"""
+ class FileSubclass(SCons.Node.FS.File):
+ pass
+ sd = self.fs._lookup('special_file', None, FileSubclass, create=1)
+ sd.must_be_same(SCons.Node.FS.File)
+
def test_Dirs(self):
"""Test the File.Dirs() method"""
fff = self.fs.File('subdir/fff')