From 198b9d4f5de693a045dee93d055da077c8d8ef70 Mon Sep 17 00:00:00 2001 From: Evgenii Alekseev Date: Fri, 17 Jul 2026 00:50:31 +0300 Subject: [PATCH] move fixtures to __init__.py --- tools/pytest_plugins/__init__.py | 1 - .../__init__.py} | 71 ++++++++++++------- tools/pytest_plugins/pyproject.toml | 2 +- 3 files changed, 46 insertions(+), 28 deletions(-) delete mode 100644 tools/pytest_plugins/__init__.py rename tools/pytest_plugins/{ahriman_fixtures.py => ahriman_fixtures/__init__.py} (95%) diff --git a/tools/pytest_plugins/__init__.py b/tools/pytest_plugins/__init__.py deleted file mode 100644 index 27574990..00000000 --- a/tools/pytest_plugins/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Repository-local pytest plugins.""" diff --git a/tools/pytest_plugins/ahriman_fixtures.py b/tools/pytest_plugins/ahriman_fixtures/__init__.py similarity index 95% rename from tools/pytest_plugins/ahriman_fixtures.py rename to tools/pytest_plugins/ahriman_fixtures/__init__.py index 5d8542f7..79b65224 100644 --- a/tools/pytest_plugins/ahriman_fixtures.py +++ b/tools/pytest_plugins/ahriman_fixtures/__init__.py @@ -1,3 +1,22 @@ +# +# Copyright (c) 2021-2025 ahriman team. +# +# This file is part of ahriman +# (see https://github.com/arcan1s/ahriman). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# import argparse import datetime import pytest @@ -132,7 +151,7 @@ def pytest_configure() -> None: # generic fixtures @pytest.fixture(autouse=True) -def register_log_context() -> None: +def _register_log_context() -> None: """ register log context variables and factory """ @@ -151,31 +170,6 @@ def args() -> argparse.Namespace: repository=None, repository_id=None, wait_timeout=-1) -@pytest.fixture -def gpg(configuration: Configuration) -> GPG: - """ - fixture for empty GPG - - Args: - configuration(Configuration): configuration fixture - - Returns: - GPG: GPG test instance - """ - return GPG(configuration) - - -@pytest.fixture -def parser() -> argparse.ArgumentParser: - """ - fixture for command line arguments parser - - Returns: - argparse.ArgumentParser: command line arguments parser instance - """ - return _parser() - - @pytest.fixture def aur_package_ahriman() -> AURPackage: """ @@ -324,6 +318,20 @@ def database(configuration: Configuration, mocker: MockerFixture) -> SQLite: return SQLite.load(configuration) +@pytest.fixture +def gpg(configuration: Configuration) -> GPG: + """ + fixture for empty GPG + + Args: + configuration(Configuration): configuration fixture + + Returns: + GPG: GPG test instance + """ + return GPG(configuration) + + @pytest.fixture def local_client(database: SQLite, configuration: Configuration) -> Client: """ @@ -493,6 +501,17 @@ def package_description_python2_schedule() -> PackageDescription: ) +@pytest.fixture +def parser() -> argparse.ArgumentParser: + """ + fixture for command line arguments parser + + Returns: + argparse.ArgumentParser: command line arguments parser instance + """ + return _parser() + + @pytest.fixture def remote_source() -> RemoteSource: """ diff --git a/tools/pytest_plugins/pyproject.toml b/tools/pytest_plugins/pyproject.toml index c4715ae7..5b2e72f5 100644 --- a/tools/pytest_plugins/pyproject.toml +++ b/tools/pytest_plugins/pyproject.toml @@ -15,4 +15,4 @@ classifiers = [ ahriman-fixtures = "ahriman_fixtures" [tool.hatch.build.targets.wheel] -packages = ["."] +packages = ["ahriman_fixtures"]