xref: /netbsd-src/external/mpl/bind/dist/bin/tests/system/doth/conftest.py (revision 4439cfd0acf9c7dc90625e5cd83b2317a9ab8967)
1#!/usr/bin/python3
2
3# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
4#
5# SPDX-License-Identifier: MPL-2.0
6#
7# This Source Code Form is subject to the terms of the Mozilla Public
8# License, v. 2.0.  If a copy of the MPL was not distributed with this
9# file, you can obtain one at https://mozilla.org/MPL/2.0/.
10#
11# See the COPYRIGHT file distributed with this work for additional
12# information regarding copyright ownership.
13
14import shutil
15
16import pytest
17import isctest
18
19
20@pytest.fixture
21def gnutls_cli_executable():
22    # Ensure gnutls-cli is available.
23    executable = shutil.which("gnutls-cli")
24    if not executable:
25        pytest.skip("gnutls-cli not found in PATH")
26
27    # Ensure gnutls-cli supports the --logfile command-line option.
28    output = isctest.run.cmd(
29        [executable, "--logfile=/dev/null"], log_stderr=False, raise_on_exception=False
30    ).stdout
31    if b"illegal option" in output:
32        pytest.skip("gnutls-cli does not support the --logfile option")
33
34    return executable
35
36
37@pytest.fixture
38def sslyze_executable():
39    # Check whether sslyze is available.
40    executable = shutil.which("sslyze")
41    if not executable:
42        pytest.skip("sslyze not found in PATH")
43
44    return executable
45