2 # -*- coding: utf-8 -*-
5 # Copyright (c) 2018 Peter Wu <peter@lekensteyn.nl>
7 # SPDX-License-Identifier: GPL-2.0-or-later
9 '''py.test configuration'''
13 def pytest_addoption(parser):
14 parser.addoption('--disable-capture', action='store_true',
15 help='Disable capture tests'
17 parser.addoption('--capture-interface',
18 help='Capture interface index or name.'
20 parser.addoption('--program-path', help='Path to Wireshark executables.')
22 _all_test_groups = None
24 # this is set only to please case_unittests.test_unit_ctest_coverage
25 def pytest_collection_modifyitems(items):
26 '''Find all test groups.'''
27 global _all_test_groups
30 name = item.nodeid.split("::")[0].replace(".py", "").replace("/", ".")
31 if name not in suites:
33 _all_test_groups = sorted(suites)
35 # Must enable pytest before importing fixtures_ws.
36 fixtures.enable_pytest()
37 from fixtures_ws import *
39 @fixtures.fixture(scope='session')
40 def all_test_groups():
41 return _all_test_groups