summaryrefslogtreecommitdiff
path: root/src/engine/SCons/Scanner/ScannerTests.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/Scanner/ScannerTests.py')
-rw-r--r--src/engine/SCons/Scanner/ScannerTests.py62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/engine/SCons/Scanner/ScannerTests.py b/src/engine/SCons/Scanner/ScannerTests.py
index a962a4c..7e2720c 100644
--- a/src/engine/SCons/Scanner/ScannerTests.py
+++ b/src/engine/SCons/Scanner/ScannerTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,7 +20,7 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-__revision__ = "src/engine/SCons/Scanner/ScannerTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/ScannerTests.py 103260fce95bf5db1c35fb2371983087d85dd611 2019-07-13 18:25:30 bdbaddog"
import SCons.compat
@@ -132,16 +132,16 @@ class BaseTestCase(unittest.TestCase):
scanned = scanner(filename, env, path)
scanned_strs = [str(x) for x in scanned]
- self.failUnless(self.filename == filename, "the filename was passed incorrectly")
- self.failUnless(self.env == env, "the environment was passed incorrectly")
- self.failUnless(scanned_strs == deps, "the dependencies were returned incorrectly")
+ self.assertTrue(self.filename == filename, "the filename was passed incorrectly")
+ self.assertTrue(self.env == env, "the environment was passed incorrectly")
+ self.assertTrue(scanned_strs == deps, "the dependencies were returned incorrectly")
for d in scanned:
- self.failUnless(not isinstance(d, str), "got a string in the dependencies")
+ self.assertTrue(not isinstance(d, str), "got a string in the dependencies")
if len(args) > 0:
- self.failUnless(self.arg == args[0], "the argument was passed incorrectly")
+ self.assertTrue(self.arg == args[0], "the argument was passed incorrectly")
else:
- self.failIf(hasattr(self, "arg"), "an argument was given when it shouldn't have been")
+ self.assertFalse(hasattr(self, "arg"), "an argument was given when it shouldn't have been")
def test___call__dict(self):
"""Test calling Scanner.Base objects with a dictionary"""
@@ -245,7 +245,7 @@ class BaseTestCase(unittest.TestCase):
dict[s] = 777
i = hash(id(s))
h = hash(list(dict.keys())[0])
- self.failUnless(h == i,
+ self.assertTrue(h == i,
"hash Scanner base class expected %s, got %s" % (i, h))
def test_scan_check(self):
@@ -260,7 +260,7 @@ class BaseTestCase(unittest.TestCase):
self.checked = {}
path = s.path(env)
scanned = s(DummyNode('x'), env, path)
- self.failUnless(self.checked['x'] == 1,
+ self.assertTrue(self.checked['x'] == 1,
"did not call check function")
def test_recursive(self):
@@ -269,42 +269,42 @@ class BaseTestCase(unittest.TestCase):
s = SCons.Scanner.Base(function = self.func)
n = s.recurse_nodes(nodes)
- self.failUnless(n == [],
+ self.assertTrue(n == [],
"default behavior returned nodes: %s" % n)
s = SCons.Scanner.Base(function = self.func, recursive = None)
n = s.recurse_nodes(nodes)
- self.failUnless(n == [],
+ self.assertTrue(n == [],
"recursive = None returned nodes: %s" % n)
s = SCons.Scanner.Base(function = self.func, recursive = 1)
n = s.recurse_nodes(nodes)
- self.failUnless(n == n,
+ self.assertTrue(n == n,
"recursive = 1 didn't return all nodes: %s" % n)
def odd_only(nodes):
return [n for n in nodes if n % 2]
s = SCons.Scanner.Base(function = self.func, recursive = odd_only)
n = s.recurse_nodes(nodes)
- self.failUnless(n == [1, 3],
+ self.assertTrue(n == [1, 3],
"recursive = 1 didn't return all nodes: %s" % n)
def test_get_skeys(self):
"""Test the Scanner.Base get_skeys() method"""
s = SCons.Scanner.Base(function = self.func)
sk = s.get_skeys()
- self.failUnless(sk == [],
+ self.assertTrue(sk == [],
"did not initialize to expected []")
s = SCons.Scanner.Base(function = self.func, skeys = ['.1', '.2'])
sk = s.get_skeys()
- self.failUnless(sk == ['.1', '.2'],
+ self.assertTrue(sk == ['.1', '.2'],
"sk was %s, not ['.1', '.2']")
s = SCons.Scanner.Base(function = self.func, skeys = '$LIST')
env = DummyEnvironment(LIST = ['.3', '.4'])
sk = s.get_skeys(env)
- self.failUnless(sk == ['.3', '.4'],
+ self.assertTrue(sk == ['.3', '.4'],
"sk was %s, not ['.3', '.4']")
def test_select(self):
@@ -432,19 +432,19 @@ class CurrentTestCase(unittest.TestCase):
path = s.path(env)
hnb = HasNoBuilder()
s(hnb, env, path)
- self.failUnless(hnb.called_has_builder, "did not call has_builder()")
- self.failUnless(not hnb.called_is_up_to_date, "did call is_up_to_date()")
- self.failUnless(hnb.func_called, "did not call func()")
+ self.assertTrue(hnb.called_has_builder, "did not call has_builder()")
+ self.assertTrue(not hnb.called_is_up_to_date, "did call is_up_to_date()")
+ self.assertTrue(hnb.func_called, "did not call func()")
inc = IsNotCurrent()
s(inc, env, path)
- self.failUnless(inc.called_has_builder, "did not call has_builder()")
- self.failUnless(inc.called_is_up_to_date, "did not call is_up_to_date()")
- self.failUnless(not inc.func_called, "did call func()")
+ self.assertTrue(inc.called_has_builder, "did not call has_builder()")
+ self.assertTrue(inc.called_is_up_to_date, "did not call is_up_to_date()")
+ self.assertTrue(not inc.func_called, "did call func()")
ic = IsCurrent()
s(ic, env, path)
- self.failUnless(ic.called_has_builder, "did not call has_builder()")
- self.failUnless(ic.called_is_up_to_date, "did not call is_up_to_date()")
- self.failUnless(ic.func_called, "did not call func()")
+ self.assertTrue(ic.called_has_builder, "did not call has_builder()")
+ self.assertTrue(ic.called_is_up_to_date, "did not call is_up_to_date()")
+ self.assertTrue(ic.func_called, "did not call func()")
class ClassicTestCase(unittest.TestCase):
@@ -461,7 +461,7 @@ class ClassicTestCase(unittest.TestCase):
def test_find_include(self):
"""Test the Scanner.Classic find_include() method"""
env = DummyEnvironment()
- s = SCons.Scanner.Classic("t", ['.suf'], 'MYPATH', '^my_inc (\S+)')
+ s = SCons.Scanner.Classic("t", ['.suf'], 'MYPATH', r'^my_inc (\S+)')
def _find_file(filename, paths):
return paths[0]+'/'+filename
@@ -479,7 +479,7 @@ class ClassicTestCase(unittest.TestCase):
def test_name(self):
"""Test setting the Scanner.Classic name"""
- s = SCons.Scanner.Classic("my_name", ['.s'], 'MYPATH', '^my_inc (\S+)')
+ s = SCons.Scanner.Classic("my_name", ['.s'], 'MYPATH', r'^my_inc (\S+)')
assert s.name == "my_name", s.name
def test_scan(self):
@@ -505,7 +505,7 @@ class ClassicTestCase(unittest.TestCase):
return include, include
env = DummyEnvironment()
- s = MyScanner("t", ['.suf'], 'MYPATH', '^my_inc (\S+)')
+ s = MyScanner("t", ['.suf'], 'MYPATH', r'^my_inc (\S+)')
# This set of tests is intended to test the scanning operation
# of the Classic scanner.
@@ -566,7 +566,7 @@ class ClassicTestCase(unittest.TestCase):
s = SCons.Scanner.Classic("Test", [], None, "", function=self.func, recursive=1)
n = s.recurse_nodes(nodes)
- self.failUnless(n == n,
+ self.assertTrue(n == n,
"recursive = 1 didn't return all nodes: %s" % n)
def odd_only(nodes):
@@ -574,7 +574,7 @@ class ClassicTestCase(unittest.TestCase):
s = SCons.Scanner.Classic("Test", [], None, "", function=self.func, recursive=odd_only)
n = s.recurse_nodes(nodes)
- self.failUnless(n == [1, 3],
+ self.assertTrue(n == [1, 3],
"recursive = 1 didn't return all nodes: %s" % n)