[elbe-devel] [PATCH 3/6] pytest: remove custom test file discovery
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Mon Jul 15 15:15:15 CEST 2024
The custom test extension creates issues when supporting old and new
versions of pytest in the same codebase without triggering deprecation
warnings.
Use the 'python_files' configuration which avoids that issue and is also
much easier to understand.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
contrib/conftest.py | 15 ---------------
pyproject.toml | 5 +++++
2 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/contrib/conftest.py b/contrib/conftest.py
deleted file mode 100644
index a6ae58318d3a..000000000000
--- a/contrib/conftest.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# ELBE - Debian Based Embedded Rootfilesystem Builder
-# SPDX-License-Identifier: GPL-3.0-or-later
-# SPDX-FileCopyrightText: 2024 Linutronix GmbH
-
-import pytest
-
-
-_additional_test_files = {
- 'check-deb-py-versions.py',
-}
-
-
-def pytest_collect_file(file_path, parent):
- if file_path.name in _additional_test_files:
- return pytest.Module.from_parent(parent, path=file_path)
diff --git a/pyproject.toml b/pyproject.toml
index 2a5d3f952a55..266c79259c83 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -6,6 +6,11 @@ single_file = false
filename = 'docs/news/{project_date}-v{version}.rst'
[tool.pytest.ini_options]
+python_files = [
+ 'test_*.py',
+ '*_test.py',
+ 'contrib/check-deb-py-versions.py',
+]
filterwarnings = 'error'
[tool.mypy]
--
2.45.2
More information about the elbe-devel
mailing list