From 4e19c3ed40e3df12fdfa7f20d88e53bc5c6649b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20=C5=9Aliwi=C5=84ski?= Date: Wed, 22 Dec 2021 10:46:15 +0100 Subject: [PATCH] Import pytest types from pytest package, not private _pytest - require at least pytest 6.2 - closes #533 --- .github/workflows/tests-macos.yml | 2 +- .github/workflows/tests.yml | 2 +- CHANGES.rst | 9 +++++++++ setup.cfg | 2 +- src/pytest_postgresql/config.py | 2 +- src/pytest_postgresql/factories/client.py | 2 +- src/pytest_postgresql/factories/noprocess.py | 2 +- src/pytest_postgresql/factories/process.py | 5 ++--- tests/test_executor.py | 2 +- tests/test_postgres_options_plugin.py | 2 +- 10 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests-macos.yml b/.github/workflows/tests-macos.yml index 6c1ad06a..2c94fa65 100644 --- a/.github/workflows/tests-macos.yml +++ b/.github/workflows/tests-macos.yml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: true matrix: - python-version: [3.7, 3.8, 3.9, "3.10", pypy-3.7-v7.3.3] + python-version: [3.7, 3.8, 3.9, "3.10", pypy-3.8-v7.3.7] postgres-version: [12, 13, 14] env: OS: macos-latest diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d398dfd8..4a6e3620 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: true matrix: - python-version: [3.7, 3.8, 3.9, "3.10", pypy-3.7-v7.3.3] + python-version: [3.7, 3.8, 3.9, "3.10", pypy-3.8-v7.3.7] postgres-version: [10, 11, 12, 13, 14] env: OS: ubuntu-latest diff --git a/CHANGES.rst b/CHANGES.rst index af77bd05..9a3a4f1b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,15 @@ CHANGELOG ========= +unreleased +---------- + +Misc +++++ + +- Import FixtureRequest, TempdirFactory from pytest, not private _pytest. + Require at least pytest 6.2 + 4.0.0 ---------- diff --git a/setup.cfg b/setup.cfg index b56c055c..4e3b97a2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,7 +35,7 @@ packages = find: package_dir = =src install_requires = - pytest>=3.0.0 + pytest>=6.2.0 port-for mirakuru>=2.3.0 diff --git a/src/pytest_postgresql/config.py b/src/pytest_postgresql/config.py index 5117bbdc..926aaa2e 100644 --- a/src/pytest_postgresql/config.py +++ b/src/pytest_postgresql/config.py @@ -1,4 +1,4 @@ -from _pytest.fixtures import FixtureRequest +from pytest import FixtureRequest def get_config(request: FixtureRequest) -> dict: diff --git a/src/pytest_postgresql/factories/client.py b/src/pytest_postgresql/factories/client.py index f4019118..979f0b60 100644 --- a/src/pytest_postgresql/factories/client.py +++ b/src/pytest_postgresql/factories/client.py @@ -19,7 +19,7 @@ from typing import List, Optional, Callable, Union, Iterator import pytest -from _pytest.fixtures import FixtureRequest +from pytest import FixtureRequest from pytest_postgresql.compat import connection, check_for_psycopg, psycopg from pytest_postgresql.executor import PostgreSQLExecutor diff --git a/src/pytest_postgresql/factories/noprocess.py b/src/pytest_postgresql/factories/noprocess.py index cfaefbe2..15cc1ddf 100644 --- a/src/pytest_postgresql/factories/noprocess.py +++ b/src/pytest_postgresql/factories/noprocess.py @@ -20,7 +20,7 @@ from typing import Union, Callable, List, Iterator, Optional import pytest -from _pytest.fixtures import FixtureRequest +from pytest import FixtureRequest from pytest_postgresql.config import get_config from pytest_postgresql.executor_noop import NoopExecutor diff --git a/src/pytest_postgresql/factories/process.py b/src/pytest_postgresql/factories/process.py index 0f002c80..cd42ca64 100644 --- a/src/pytest_postgresql/factories/process.py +++ b/src/pytest_postgresql/factories/process.py @@ -19,12 +19,11 @@ import os.path import platform import subprocess -from _warnings import warn from typing import Union, Callable, List, Iterator, Optional, Tuple, Set +from warnings import warn import pytest -from _pytest.fixtures import FixtureRequest -from _pytest.tmpdir import TempdirFactory +from pytest import FixtureRequest, TempdirFactory from port_for import get_port from pytest_postgresql.config import get_config diff --git a/tests/test_executor.py b/tests/test_executor.py index 01093f63..334fb6c7 100644 --- a/tests/test_executor.py +++ b/tests/test_executor.py @@ -2,7 +2,7 @@ import sys from typing import Any -from _pytest.fixtures import FixtureRequest +from pytest import FixtureRequest from pkg_resources import parse_version import pytest diff --git a/tests/test_postgres_options_plugin.py b/tests/test_postgres_options_plugin.py index 6fc889cc..39131080 100644 --- a/tests/test_postgres_options_plugin.py +++ b/tests/test_postgres_options_plugin.py @@ -1,6 +1,6 @@ """Test behavior of postgres_options passed in different ways.""" -from _pytest.pytester import Pytester +from pytest import Pytester def test_postgres_options_config_in_cli(pytester: Pytester) -> None: