diff options
author | Peter Wu <peter@lekensteyn.nl> | 2018-11-15 18:44:59 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2018-11-16 13:55:28 +0000 |
commit | 3ab521118a0d068e0d5c795a5a57b13cd7790a75 (patch) | |
tree | 72900c817752260ab91945cc85302b78f8eaffe6 /test/suite_unittests.py | |
parent | cb9be3850da46ca1f706a00b16cdb65a95ce66a0 (diff) |
test: convert capture tests to use fixtures, fix tests without dumpcap
Add a new --capture-interface option to pytest, similar to test.py. It
will grab some Ethernet interface on Windows. An empty value overrides
this and disables capture tests. Remove the test.py --enable-capture
option since that is implied by the --capture-interface option.
Port the `test.py --program-path` option to pytest and additionally make
the pytest look in the current working directory if neither WS_BIN_PATH
nor --program-path are specified. Drop config.setProgramPath, this
allows tests to be run even if not all binaries are available.
With all capture tests converted to fixtures, it is now possible to run
tests when Wireshark is not built with libpcap as tests that depend on
cmd_dumpcap (or capture_interface) will be skipped.
Bug: 14949
Change-Id: Ie802c07904936de4cd30a4c68b6a5139e6680fbd
Reviewed-on: https://code.wireshark.org/review/30656
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'test/suite_unittests.py')
-rw-r--r-- | test/suite_unittests.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/test/suite_unittests.py b/test/suite_unittests.py index 94621ed7fa..6200dcfcba 100644 --- a/test/suite_unittests.py +++ b/test/suite_unittests.py @@ -11,7 +11,6 @@ # '''EPAN unit tests''' -import config import difflib import os.path import re @@ -53,7 +52,7 @@ class case_unittests(subprocesstest.SubprocessTestCase): '''fieldcount''' self.assertRun((cmd_tshark, '-G', 'fieldcount'), env=test_env) - def test_unit_ctest_coverage(self): + def test_unit_ctest_coverage(self, all_test_groups): '''Make sure CTest runs all of our tests.''' with open(os.path.join(os.path.dirname(__file__), '..', 'CMakeLists.txt')) as cml_fd: group_re = re.compile(r'set *\( *_test_group_list') @@ -68,8 +67,8 @@ class case_unittests(subprocesstest.SubprocessTestCase): break cml_groups.append(cml_line.strip()) cml_groups.sort() - if not config.all_groups == cml_groups: - diff = '\n'.join(list(difflib.unified_diff(config.all_groups, cml_groups, 'all test groups', 'CMakeLists.txt test groups'))) + if not all_test_groups == cml_groups: + diff = '\n'.join(list(difflib.unified_diff(all_test_groups, cml_groups, 'all test groups', 'CMakeLists.txt test groups'))) self.fail("CMakeLists.txt doesn't test all available groups:\n" + diff) |