Compare major.minor python version to be expected one

This commit is contained in:
Ayaz Salikhov
2022-05-31 22:40:39 +04:00
parent 5e1a27a812
commit 84d041b9df
3 changed files with 9 additions and 15 deletions

View File

@@ -27,9 +27,6 @@ ignore_missing_imports = True
[mypy-matplotlib.*] [mypy-matplotlib.*]
ignore_missing_imports = True ignore_missing_imports = True
[mypy-packaging.*]
ignore_missing_imports = True
[mypy-pandas.*] [mypy-pandas.*]
ignore_missing_imports = True ignore_missing_imports = True

View File

@@ -1,5 +1,4 @@
docker docker
packaging
plumbum plumbum
pre-commit pre-commit
pytest pytest

View File

@@ -2,25 +2,23 @@
# Distributed under the terms of the Modified BSD License. # Distributed under the terms of the Modified BSD License.
import logging import logging
from packaging import version # type: ignore
from tests.conftest import TrackedContainer from tests.conftest import TrackedContainer
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
EXPECTED_PYTHON_VERSION = "3.10"
def test_python_version( def test_python_version(container: TrackedContainer) -> None:
container: TrackedContainer, python_next_version: str = "3.11" LOGGER.info(
) -> None: f"Checking that python major.minor version is {EXPECTED_PYTHON_VERSION}"
"""Check that python version is lower than the next version""" )
LOGGER.info(f"Checking that python version is lower than {python_next_version}")
logs = container.run_and_wait( logs = container.run_and_wait(
timeout=5, timeout=5,
tty=True, tty=True,
command=["python", "--version"], command=["python", "--version"],
) )
assert logs.startswith("Python ") assert logs.startswith("Python ")
actual_python_version = version.parse(logs.split()[1]) full_version = logs.split()[1]
assert actual_python_version < version.parse( major_minor_version = full_version[: full_version.rfind(".")]
python_next_version
), f"Python version shall be lower than {python_next_version}" assert major_minor_version == EXPECTED_PYTHON_VERSION