move fixtures to __init__.py

This commit is contained in:
2026-07-17 00:50:31 +03:00
parent da1ded5c0e
commit 198b9d4f5d
3 changed files with 46 additions and 28 deletions
-1
View File
@@ -1 +0,0 @@
"""Repository-local pytest plugins."""
@@ -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 <http://www.gnu.org/licenses/>.
#
import argparse import argparse
import datetime import datetime
import pytest import pytest
@@ -132,7 +151,7 @@ def pytest_configure() -> None:
# generic fixtures # generic fixtures
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def register_log_context() -> None: def _register_log_context() -> None:
""" """
register log context variables and factory register log context variables and factory
""" """
@@ -151,31 +170,6 @@ def args() -> argparse.Namespace:
repository=None, repository_id=None, wait_timeout=-1) 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 @pytest.fixture
def aur_package_ahriman() -> AURPackage: def aur_package_ahriman() -> AURPackage:
""" """
@@ -324,6 +318,20 @@ def database(configuration: Configuration, mocker: MockerFixture) -> SQLite:
return SQLite.load(configuration) 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 @pytest.fixture
def local_client(database: SQLite, configuration: Configuration) -> Client: 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 @pytest.fixture
def remote_source() -> RemoteSource: def remote_source() -> RemoteSource:
""" """
+1 -1
View File
@@ -15,4 +15,4 @@ classifiers = [
ahriman-fixtures = "ahriman_fixtures" ahriman-fixtures = "ahriman_fixtures"
[tool.hatch.build.targets.wheel] [tool.hatch.build.targets.wheel]
packages = ["."] packages = ["ahriman_fixtures"]