Debian Codegraph @

tests/benchmarks/conftest.py

raw
1 # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
2 # For details: https://github.com/pylint-dev/astroid/blob/main/LICENSE
3 # Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt
4
5 """Skip the benchmark suite when ``pytest-codspeed`` is not installed.
6
7 The ``benchmark`` fixture used by every test in this directory is provided
8 by the ``pytest-codspeed`` plugin. CI installs it explicitly in the
9 CodSpeed workflow, but contributors running ``pytest tests/`` locally will
10 not have it. Without this guard pytest would error out with
11 ``fixture 'benchmark' not found`` (and, because ``filterwarnings = "error"``
12 is set in ``pyproject.toml``, even a warning would abort collection).
13 """
14
15 try:
16 import pytest_codspeed # noqa: F401 # pylint: disable=unused-import
17 except ImportError:
18 collect_ignore_glob = ["test_bench_*.py"]