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.*]
|
[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
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
docker
|
docker
|
||||||
packaging
|
|
||||||
plumbum
|
plumbum
|
||||||
pre-commit
|
pre-commit
|
||||||
pytest
|
pytest
|
||||||
|
@@ -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
|
||||||
|
Reference in New Issue
Block a user