From 6b448500b3724867206863cba6dabf24a61a009c Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Mon, 7 Jul 2025 17:56:26 +0300 Subject: [PATCH 1/2] A support of python 3.7.17 is added The problem was in pluggy.Result. In the python 3.7 this thing has the name pluggy._result._Result CI now tests python 3.7, too. The exact latest version of python 3.7 is v3.7.17. --- .travis.yml | 1 + Dockerfile--std2-all.tmpl | 4 ++++ README.md | 2 +- tests/conftest.py | 24 ++++++++++++++++-------- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 55b7afa..b762b0d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,7 @@ notifications: on_failure: always env: + - TEST_PLATFORM=std2-all PYTHON_VERSION=3.7 PG_VERSION=17 - TEST_PLATFORM=std2-all PYTHON_VERSION=3.8.0 PG_VERSION=17 - TEST_PLATFORM=std2-all PYTHON_VERSION=3.8 PG_VERSION=17 - TEST_PLATFORM=std2-all PYTHON_VERSION=3.9 PG_VERSION=17 diff --git a/Dockerfile--std2-all.tmpl b/Dockerfile--std2-all.tmpl index 10d8280..6a3d817 100644 --- a/Dockerfile--std2-all.tmpl +++ b/Dockerfile--std2-all.tmpl @@ -20,6 +20,10 @@ RUN apk add openssl openssl-dev RUN apk add sqlite-dev RUN apk add bzip2-dev +# --------------------------------------------- base3_with_python-3.7 +FROM base2_with_python-3 as base3_with_python-3.7 +ENV PYTHON_VERSION=3.7 + # --------------------------------------------- base3_with_python-3.8.0 FROM base2_with_python-3 as base3_with_python-3.8.0 ENV PYTHON_VERSION=3.8.0 diff --git a/README.md b/README.md index defbc8b..af8172f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ # testgres -PostgreSQL testing utility. Python 3.8+ is supported. +PostgreSQL testing utility. Python 3.7.17+ is supported. ## Installation diff --git a/tests/conftest.py b/tests/conftest.py index 25580ae..bea516b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,6 +4,7 @@ import pluggy import pytest import os +import sys import logging import pathlib import math @@ -16,6 +17,13 @@ # ///////////////////////////////////////////////////////////////////////////// +if sys.version_info < (3, 8): + T_PLUGGY_RESULT = pluggy._result._Result +else: + T_PLUGGY_RESULT = pluggy.Result + +# ///////////////////////////////////////////////////////////////////////////// + C_ROOT_DIR__RELATIVE = ".." # ///////////////////////////////////////////////////////////////////////////// @@ -344,7 +352,7 @@ def helper__build_test_id(item: pytest.Function) -> str: def helper__makereport__setup( - item: pytest.Function, call: pytest.CallInfo, outcome: pluggy.Result + item: pytest.Function, call: pytest.CallInfo, outcome: T_PLUGGY_RESULT ): assert item is not None assert call is not None @@ -352,7 +360,7 @@ def helper__makereport__setup( # it may be pytest.Function or _pytest.unittest.TestCaseFunction assert isinstance(item, pytest.Function) assert type(call) == pytest.CallInfo # noqa: E721 - assert type(outcome) == pluggy.Result # noqa: E721 + assert type(outcome) == T_PLUGGY_RESULT # noqa: E721 C_LINE1 = "******************************************************" @@ -403,7 +411,7 @@ def helper__makereport__setup( # ------------------------------------------------------------------------ def helper__makereport__call( - item: pytest.Function, call: pytest.CallInfo, outcome: pluggy.Result + item: pytest.Function, call: pytest.CallInfo, outcome: T_PLUGGY_RESULT ): assert item is not None assert call is not None @@ -411,7 +419,7 @@ def helper__makereport__call( # it may be pytest.Function or _pytest.unittest.TestCaseFunction assert isinstance(item, pytest.Function) assert type(call) == pytest.CallInfo # noqa: E721 - assert type(outcome) == pluggy.Result # noqa: E721 + assert type(outcome) == T_PLUGGY_RESULT # noqa: E721 # -------- item_error_msg_count1 = item.stash.get(g_error_msg_count_key, 0) @@ -578,9 +586,9 @@ def pytest_runtest_makereport(item: pytest.Function, call: pytest.CallInfo): assert isinstance(item, pytest.Function) assert type(call) == pytest.CallInfo # noqa: E721 - outcome: pluggy.Result = yield + outcome = yield assert outcome is not None - assert type(outcome) == pluggy.Result # noqa: E721 + assert type(outcome) == T_PLUGGY_RESULT # noqa: E721 assert type(call.when) == str # noqa: E721 @@ -738,10 +746,10 @@ def pytest_pyfunc_call(pyfuncitem: pytest.Function): assert logWrapper._critical_counter == 0 assert logging.root.handle is logWrapper - r: pluggy.Result = yield + r = yield assert r is not None - assert type(r) == pluggy.Result # noqa: E721 + assert type(r) == T_PLUGGY_RESULT # noqa: E721 assert logWrapper._old_method is not None assert type(logWrapper._err_counter) == int # noqa: E721 From f19a838bcc4961dcbdd58c13e30b14eb7d926290 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Mon, 7 Jul 2025 18:27:38 +0300 Subject: [PATCH 2/2] Lets check pluggy.__version__ not sys.version_info --- tests/conftest.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index bea516b..a76f2eb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,7 +4,6 @@ import pluggy import pytest import os -import sys import logging import pathlib import math @@ -15,16 +14,19 @@ import _pytest.unittest import _pytest.logging +from packaging.version import Version + # ///////////////////////////////////////////////////////////////////////////// -if sys.version_info < (3, 8): - T_PLUGGY_RESULT = pluggy._result._Result -else: - T_PLUGGY_RESULT = pluggy.Result +C_ROOT_DIR__RELATIVE = ".." # ///////////////////////////////////////////////////////////////////////////// +# T_PLUGGY_RESULT -C_ROOT_DIR__RELATIVE = ".." +if Version(pluggy.__version__) <= Version("1.2"): + T_PLUGGY_RESULT = pluggy._result._Result +else: + T_PLUGGY_RESULT = pluggy.Result # ///////////////////////////////////////////////////////////////////////////// # TestConfigPropNames