summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2022-06-14 00:36:40 (GMT)
committerGitHub <noreply@github.com>2022-06-14 00:36:40 (GMT)
commit2a853ac85704a8e72d7d57d3aa0c7a7ed4edd48a (patch)
tree09069eaba95608188925dd61b1fdfcd2d29bea15 /testing
parentfc6a0e35e7bc1c25aa0359a2391e31ce4ab2dd1f (diff)
parente03c43bb041ac7910c083912b87458f597320454 (diff)
downloadSCons-2a853ac85704a8e72d7d57d3aa0c7a7ed4edd48a.zip
SCons-2a853ac85704a8e72d7d57d3aa0c7a7ed4edd48a.tar.gz
SCons-2a853ac85704a8e72d7d57d3aa0c7a7ed4edd48a.tar.bz2
Merge branch 'master' into ninja_exit_daemon
Diffstat (limited to 'testing')
-rw-r--r--testing/framework/TestCmd.py6
-rw-r--r--testing/framework/TestCmdTests.py76
2 files changed, 16 insertions, 66 deletions
diff --git a/testing/framework/TestCmd.py b/testing/framework/TestCmd.py
index 2d3428c..e0af333 100644
--- a/testing/framework/TestCmd.py
+++ b/testing/framework/TestCmd.py
@@ -1157,6 +1157,9 @@ class TestCmd:
interpreter = [interpreter]
cmd = list(interpreter) + cmd
if arguments:
+ if isinstance(arguments, dict):
+ cmd.extend(["%s=%s" % (k, v) for k, v in arguments.items()])
+ return cmd
if isinstance(arguments, str):
arguments = arguments.split()
cmd.extend(arguments)
@@ -1601,6 +1604,9 @@ class TestCmd:
The specified program will have the original directory
prepended unless it is enclosed in a [list].
+
+ argument: If this is a dict() then will create arguments with KEY+VALUE for
+ each entry in the dict.
"""
if self.external:
if not program:
diff --git a/testing/framework/TestCmdTests.py b/testing/framework/TestCmdTests.py
index 3b29091..8e5ecda 100644
--- a/testing/framework/TestCmdTests.py
+++ b/testing/framework/TestCmdTests.py
@@ -2261,6 +2261,12 @@ class command_args_TestCase(TestCmdTestCase):
expect = ['PYTHON', default_prog, 'arg3', 'arg4']
assert r == expect, (expect, r)
+ # Test arguments = dict
+ r = test.command_args(interpreter='PYTHON', arguments={'VAR1':'1'})
+ expect = ['PYTHON', default_prog, 'VAR1=1']
+ assert r == expect, (expect, r)
+
+
test.interpreter_set('default_python')
r = test.command_args()
@@ -2585,7 +2591,7 @@ script_recv: STDERR: input
with open(t.recv_out_path, 'rb') as f:
result = to_str(f.read())
expect = 'script_recv: ' + input
- assert result == expect, repr(result)
+ assert result == expect, "Result:[%s] should match\nExpected:[%s]" % (result, expect)
p = test.start(stdin=1)
input = 'send() input to the receive script\n'
@@ -3103,7 +3109,7 @@ class workpath_TestCase(TestCmdTestCase):
assert wpath == os.path.join(test.workdir, 'foo', 'bar')
-
+@unittest.skipIf(sys.platform == 'win32', "Don't run on win32")
class readable_TestCase(TestCmdTestCase):
def test_readable(self):
"""Test readable()"""
@@ -3183,7 +3189,7 @@ class writable_TestCase(TestCmdTestCase):
assert not _is_writable(test.workpath('file1'))
-
+@unittest.skipIf(sys.platform == 'win32', "Don't run on win32")
class executable_TestCase(TestCmdTestCase):
def test_executable(self):
"""Test executable()"""
@@ -3331,70 +3337,8 @@ class variables_TestCase(TestCmdTestCase):
assert stderr == "", stderr
-
if __name__ == "__main__":
- tclasses = [
- __init__TestCase,
- basename_TestCase,
- cleanup_TestCase,
- chmod_TestCase,
- combine_TestCase,
- command_args_TestCase,
- description_TestCase,
- diff_TestCase,
- diff_stderr_TestCase,
- diff_stdout_TestCase,
- exit_TestCase,
- fail_test_TestCase,
- interpreter_TestCase,
- match_TestCase,
- match_exact_TestCase,
- match_re_dotall_TestCase,
- match_re_TestCase,
- match_stderr_TestCase,
- match_stdout_TestCase,
- no_result_TestCase,
- pass_test_TestCase,
- preserve_TestCase,
- program_TestCase,
- read_TestCase,
- rmdir_TestCase,
- run_TestCase,
- run_verbose_TestCase,
- set_diff_function_TestCase,
- set_match_function_TestCase,
- sleep_TestCase,
- start_TestCase,
- stderr_TestCase,
- stdin_TestCase,
- stdout_TestCase,
- subdir_TestCase,
- symlink_TestCase,
- tempdir_TestCase,
- timeout_TestCase,
- unlink_TestCase,
- touch_TestCase,
- verbose_TestCase,
- workdir_TestCase,
- workdirs_TestCase,
- workpath_TestCase,
- writable_TestCase,
- write_TestCase,
- variables_TestCase,
- ]
- if sys.platform != 'win32':
- tclasses.extend([
- executable_TestCase,
- readable_TestCase,
- ])
- suite = unittest.TestSuite()
- for tclass in tclasses:
- loader = unittest.TestLoader()
- loader.testMethodPrefix = 'test_'
- names = loader.getTestCaseNames(tclass)
- suite.addTests([tclass(n) for n in names])
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ unittest.main()
# Local Variables:
# tab-width:4