summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2024-11-20 15:11:21 (GMT)
committerMats Wichmann <mats@linux.com>2024-11-20 15:11:21 (GMT)
commit53c252242ced51eb4c29047dad9de1cca22773f1 (patch)
tree0e26137e1b1281357b23aee4f34298e178813e43
parenta8ef7dd990df10a0011bbe1e2d86262133094320 (diff)
downloadSCons-53c252242ced51eb4c29047dad9de1cca22773f1.zip
SCons-53c252242ced51eb4c29047dad9de1cca22773f1.tar.gz
SCons-53c252242ced51eb4c29047dad9de1cca22773f1.tar.bz2
Update unittest for unkown variables
Signed-off-by: Mats Wichmann <mats@linux.com>
-rw-r--r--SCons/Variables/VariablesTests.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/SCons/Variables/VariablesTests.py b/SCons/Variables/VariablesTests.py
index 87b7c60..80c4d11 100644
--- a/SCons/Variables/VariablesTests.py
+++ b/SCons/Variables/VariablesTests.py
@@ -656,12 +656,13 @@ class UnknownVariablesTestCase(unittest.TestCase):
def test_AddOptionUpdatesUnknown(self) -> None:
"""Test updating of the 'unknown' dict.
- Get one unknown from args, one from a variables file. Add one
- of those later, make sure it gets removed from 'unknown' when added.
+ Get one unknown from args and one from a variables file.
+ Add these later, making sure they no longer appear in unknowns
+ after the subsequent Update().
"""
test = TestSCons.TestSCons()
var_file = test.workpath('vars.py')
- test.write('vars.py', 'FROMFILE="notadded"')
+ test.write('vars.py', 'FROMFILE="added"')
opts = SCons.Variables.Variables(files=var_file)
opts.Add('A', 'A test variable', "1")
args = {
@@ -674,10 +675,11 @@ class UnknownVariablesTestCase(unittest.TestCase):
r = opts.UnknownVariables()
with self.subTest():
self.assertEqual('notaddedyet', r['ADDEDLATER'])
- self.assertEqual('notadded', r['FROMFILE'])
+ self.assertEqual('added', r['FROMFILE'])
self.assertEqual('a', env['A'])
opts.Add('ADDEDLATER', 'An option not present initially', "1")
+ opts.Add('FROMFILE', 'An option from a file also absent', "1")
args = {
'A' : 'a',
'ADDEDLATER' : 'added',
@@ -686,10 +688,11 @@ class UnknownVariablesTestCase(unittest.TestCase):
r = opts.UnknownVariables()
with self.subTest():
- self.assertEqual(1, len(r)) # should still have FROMFILE
+ self.assertEqual(0, len(r))
self.assertNotIn('ADDEDLATER', r)
self.assertEqual('added', env['ADDEDLATER'])
- self.assertIn('FROMFILE', r)
+ self.assertNotIn('FROMFILE', r)
+ self.assertEqual('added', env['FROMFILE'])
def test_AddOptionWithAliasUpdatesUnknown(self) -> None:
"""Test updating of the 'unknown' dict (with aliases)"""