![Gerald Combs](/assets/img/avatar_default.png)
PEP 394[1] says, "In cases where the script is expected to be executed outside virtual environments, developers will need to be aware of the following discrepancies across platforms and installation methods: * Older Linux distributions will provide a python command that refers to Python 2, and will likely not provide a python2 command. * Some newer Linux distributions will provide a python command that refers to Python 3. * Some Linux distributions will not provide a python command at all by default, but will provide a python3 command by default." Debian has forced the issue by choosing the third option[2]: "NOTE: Debian testing (bullseye) has removed the "python" package and the '/usr/bin/python' symlink due to the deprecation of Python 2." Switch our shebang from "#!/usr/bin/env python" to "#!/usr/bin/env python3" in some places. Remove some 2/3 version checks if we know we're running under Python 3. Remove the "coding: utf-8" in a bunch of places since that's the default in Python 3. [1]https://www.python.org/dev/peps/pep-0394/#for-python-script-publishers [2]https://wiki.debian.org/Python
47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
#
|
|
# Wireshark tests
|
|
#
|
|
# Copyright (c) 2019 Gerald Combs <gerald@wireshark.org>
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
#
|
|
'''Release tests'''
|
|
|
|
import fixtures
|
|
import re
|
|
import subprocess
|
|
import subprocesstest
|
|
import types
|
|
|
|
@fixtures.fixture
|
|
def wireshark_features(request, cmd_wireshark, make_env):
|
|
'''
|
|
Returns an object describing available features in Wireshark. Tests
|
|
will be skipped unless --enable-release is passed on the command line.
|
|
'''
|
|
enabled = request.config.getoption('--enable-release', default=False)
|
|
if not enabled:
|
|
fixtures.skip('Release tests are not enabled via --enable-release')
|
|
|
|
try:
|
|
wireshark_v = subprocess.check_output(
|
|
(cmd_wireshark, '--version'),
|
|
stderr=subprocess.PIPE,
|
|
universal_newlines=True,
|
|
env=make_env()
|
|
)
|
|
wireshark_v = re.sub(r'\s+', ' ', wireshark_v)
|
|
except subprocess.CalledProcessError as ex:
|
|
print('Failed to detect Wireshark features: %s' % (ex,))
|
|
wireshark_v = ''
|
|
return types.SimpleNamespace(
|
|
have_automatic_updates='with automatic updates' in wireshark_v,
|
|
)
|
|
|
|
@fixtures.uses_fixtures
|
|
class case_release_automatic_updates(subprocesstest.SubprocessTestCase):
|
|
def test_automatic_updates_present(self, wireshark_features):
|
|
'''Checks whether Wireshark was built with automatic updates.'''
|
|
|
|
self.assertTrue(wireshark_features.have_automatic_updates);
|