mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-13 04:52:57 +00:00
Compare major.minor python version to be expected one
This commit is contained in:
3
mypy.ini
3
mypy.ini
@@ -27,9 +27,6 @@ ignore_missing_imports = True
|
||||
[mypy-matplotlib.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-packaging.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-pandas.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
docker
|
||||
packaging
|
||||
plumbum
|
||||
pre-commit
|
||||
pytest
|
||||
|
@@ -2,25 +2,23 @@
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
import logging
|
||||
|
||||
from packaging import version # type: ignore
|
||||
|
||||
from tests.conftest import TrackedContainer
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
EXPECTED_PYTHON_VERSION = "3.10"
|
||||
|
||||
|
||||
def test_python_version(
|
||||
container: TrackedContainer, python_next_version: str = "3.11"
|
||||
) -> None:
|
||||
"""Check that python version is lower than the next version"""
|
||||
LOGGER.info(f"Checking that python version is lower than {python_next_version}")
|
||||
def test_python_version(container: TrackedContainer) -> None:
|
||||
LOGGER.info(
|
||||
f"Checking that python major.minor version is {EXPECTED_PYTHON_VERSION}"
|
||||
)
|
||||
logs = container.run_and_wait(
|
||||
timeout=5,
|
||||
tty=True,
|
||||
command=["python", "--version"],
|
||||
)
|
||||
assert logs.startswith("Python ")
|
||||
actual_python_version = version.parse(logs.split()[1])
|
||||
assert actual_python_version < version.parse(
|
||||
python_next_version
|
||||
), f"Python version shall be lower than {python_next_version}"
|
||||
full_version = logs.split()[1]
|
||||
major_minor_version = full_version[: full_version.rfind(".")]
|
||||
|
||||
assert major_minor_version == EXPECTED_PYTHON_VERSION
|
||||
|
Reference in New Issue
Block a user