8c698ffc99
Avoid pinging www.wireshark.org, this removes an external dependency. Instead send small UDP datagrams to UDP port 9 (discard) every 50ms. Enable this for all platforms (including macOS and Linux) by default. On Windows the tests requires Npcap and will be skipped with WinPcap. Remove the --capture-interface option since it is no longer needed. Copy WSDG Wireshark Tests Quick Start to README.test and add a link. Change-Id: Id4105a6b1e95407ebf69b871c785c68f9ae26368 Reviewed-on: https://code.wireshark.org/review/31677 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
#
|
|
# -*- coding: utf-8 -*-
|
|
# Wireshark tests
|
|
#
|
|
# Copyright (c) 2018 Peter Wu <peter@lekensteyn.nl>
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
#
|
|
'''pytest configuration'''
|
|
|
|
import re
|
|
import fixtures
|
|
|
|
def pytest_addoption(parser):
|
|
parser.addoption('--disable-capture', action='store_true',
|
|
help='Disable capture tests'
|
|
)
|
|
parser.addoption('--program-path', help='Path to Wireshark executables.')
|
|
parser.addoption('--skip-missing-programs',
|
|
help='Skip tests that lack programs from this list instead of failing'
|
|
' them. Use "all" to ignore all missing programs.')
|
|
|
|
_all_test_groups = None
|
|
|
|
# this is set only to please case_unittests.test_unit_ctest_coverage
|
|
def pytest_collection_modifyitems(items):
|
|
'''Find all test groups.'''
|
|
global _all_test_groups
|
|
suites = []
|
|
for item in items:
|
|
name = item.nodeid.split("::")[0].replace(".py", "")
|
|
# When executed from the rootdir (e.g. "pytest test"), be sure to strip
|
|
# all preceding components ("test/suite_io" -> "suite_io").
|
|
name = re.sub(r'^.*/suite_', 'suite_', name)
|
|
name = name.replace("/", ".")
|
|
if name not in suites:
|
|
suites.append(name)
|
|
_all_test_groups = sorted(suites)
|
|
|
|
# Must enable pytest before importing fixtures_ws.
|
|
fixtures.enable_pytest()
|
|
from fixtures_ws import *
|
|
|
|
@fixtures.fixture(scope='session')
|
|
def all_test_groups():
|
|
return _all_test_groups
|