From c5d77166cfb9b37cad4b08edf263307c4fb12f07 Mon Sep 17 00:00:00 2001 From: gram Date: Tue, 11 Apr 2023 14:12:04 +0200 Subject: [PATCH 1/3] Python 3.8 compatibility --- pyproject.toml | 7 +++++-- pytypest/_case.py | 3 ++- pytypest/_fixture.py | 3 ++- pytypest/_fixture_factory.py | 3 ++- pytypest/_parametrize.py | 3 ++- pytypest/experimental/_attr.py | 3 ++- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d52bfd0..df1b8e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,10 @@ keywords = [ "framework", "fixtures", ] -dependencies = ["pytest"] +dependencies = [ + "pytest", + "typing-extensions", +] [project.optional-dependencies] test = [ @@ -52,7 +55,7 @@ Source = "https://github.com/orsinium-labs/pytypest" [tool.mypy] files = ["pytypest", "tests", "integration"] -python_version = "3.10" +python_version = "3.8" ignore_missing_imports = true # follow_imports = "silent" show_error_codes = true diff --git a/pytypest/_case.py b/pytypest/_case.py index 6509683..41196c5 100644 --- a/pytypest/_case.py +++ b/pytypest/_case.py @@ -1,7 +1,8 @@ from __future__ import annotations import dataclasses -from typing import Any, Generic, ParamSpec, TypeVar +from typing import Any, Generic, TypeVar +from typing_extensions import ParamSpec P = ParamSpec('P') diff --git a/pytypest/_fixture.py b/pytypest/_fixture.py index 973ff2e..0708c01 100644 --- a/pytypest/_fixture.py +++ b/pytypest/_fixture.py @@ -3,7 +3,8 @@ import inspect from dataclasses import dataclass, field from enum import Enum -from typing import Callable, Generic, Iterator, Literal, ParamSpec, TypeVar +from typing import Callable, Generic, Iterator, Literal, TypeVar +from typing_extensions import ParamSpec from ._manager import defer from ._scope import Scope diff --git a/pytypest/_fixture_factory.py b/pytypest/_fixture_factory.py index 088b24b..1151742 100644 --- a/pytypest/_fixture_factory.py +++ b/pytypest/_fixture_factory.py @@ -8,7 +8,8 @@ if TYPE_CHECKING: - from typing import Callable, Iterator, Literal, ParamSpec, TypeVar + from typing import Callable, Iterator, Literal, TypeVar + from typing_extensions import ParamSpec R = TypeVar('R') P = ParamSpec('P') diff --git a/pytypest/_parametrize.py b/pytypest/_parametrize.py index b1a55eb..1e3fdbd 100644 --- a/pytypest/_parametrize.py +++ b/pytypest/_parametrize.py @@ -1,7 +1,8 @@ from __future__ import annotations import inspect -from typing import TYPE_CHECKING, Callable, ParamSpec +from typing import TYPE_CHECKING, Callable +from typing_extensions import ParamSpec import pytest diff --git a/pytypest/experimental/_attr.py b/pytypest/experimental/_attr.py index df1d6ef..6ba7dfe 100644 --- a/pytypest/experimental/_attr.py +++ b/pytypest/experimental/_attr.py @@ -1,7 +1,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import TYPE_CHECKING, Any, Generic, ParamSpec, TypeVar, overload +from typing import TYPE_CHECKING, Any, Generic, TypeVar, overload +from typing_extensions import ParamSpec if TYPE_CHECKING: From 04697255235a399540557dd44bcb712778271164 Mon Sep 17 00:00:00 2001 From: gram Date: Tue, 11 Apr 2023 14:12:21 +0200 Subject: [PATCH 2/3] run CI for 3.8 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a77b767..59b70e1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 From 65ba2a83017aa02f0684ae8ee7fc7728461160c4 Mon Sep 17 00:00:00 2001 From: gram Date: Tue, 11 Apr 2023 14:13:24 +0200 Subject: [PATCH 3/3] sort imports --- pytypest/_case.py | 1 + pytypest/_fixture.py | 1 + pytypest/_fixture_factory.py | 1 + pytypest/_parametrize.py | 2 +- pytypest/experimental/_attr.py | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pytypest/_case.py b/pytypest/_case.py index 41196c5..663b920 100644 --- a/pytypest/_case.py +++ b/pytypest/_case.py @@ -2,6 +2,7 @@ import dataclasses from typing import Any, Generic, TypeVar + from typing_extensions import ParamSpec diff --git a/pytypest/_fixture.py b/pytypest/_fixture.py index 0708c01..ece0b6c 100644 --- a/pytypest/_fixture.py +++ b/pytypest/_fixture.py @@ -4,6 +4,7 @@ from dataclasses import dataclass, field from enum import Enum from typing import Callable, Generic, Iterator, Literal, TypeVar + from typing_extensions import ParamSpec from ._manager import defer diff --git a/pytypest/_fixture_factory.py b/pytypest/_fixture_factory.py index 1151742..bee3625 100644 --- a/pytypest/_fixture_factory.py +++ b/pytypest/_fixture_factory.py @@ -9,6 +9,7 @@ if TYPE_CHECKING: from typing import Callable, Iterator, Literal, TypeVar + from typing_extensions import ParamSpec R = TypeVar('R') diff --git a/pytypest/_parametrize.py b/pytypest/_parametrize.py index 1e3fdbd..5629868 100644 --- a/pytypest/_parametrize.py +++ b/pytypest/_parametrize.py @@ -2,9 +2,9 @@ import inspect from typing import TYPE_CHECKING, Callable -from typing_extensions import ParamSpec import pytest +from typing_extensions import ParamSpec from ._case import Case diff --git a/pytypest/experimental/_attr.py b/pytypest/experimental/_attr.py index 6ba7dfe..a9591b7 100644 --- a/pytypest/experimental/_attr.py +++ b/pytypest/experimental/_attr.py @@ -2,6 +2,7 @@ from dataclasses import dataclass from typing import TYPE_CHECKING, Any, Generic, TypeVar, overload + from typing_extensions import ParamSpec