From d5250d3b50e30ba7331b32b3db2f02ab1e1e199b Mon Sep 17 00:00:00 2001 From: Ilia Kurenkov Date: Tue, 17 Sep 2024 22:36:04 +0200 Subject: [PATCH] Improve assertions in test for python upgrade script (#18606) * Improve assertions in test for python upgrade script * bump python version in conftest * lint --------- Co-authored-by: Kyle-Neale --- ddev/tests/cli/meta/scripts/conftest.py | 11 +++++------ ddev/tests/cli/meta/scripts/test_upgrade_python.py | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ddev/tests/cli/meta/scripts/conftest.py b/ddev/tests/cli/meta/scripts/conftest.py index d92dc4481cfcc..3eef49fef96ff 100644 --- a/ddev/tests/cli/meta/scripts/conftest.py +++ b/ddev/tests/cli/meta/scripts/conftest.py @@ -5,8 +5,10 @@ from ddev.repo.core import Repository -OLD_PYTHON_VERSION = "3.11" -NEW_PYTHON_VERSION = "3.12" +# Whenenever we bump python version, we also need to bump the python +# version in the conftest.py. +OLD_PYTHON_VERSION = "3.12" +NEW_PYTHON_VERSION = "3.13" @pytest.fixture @@ -43,7 +45,7 @@ def fake_repo(tmp_path_factory, config_file, ddev): f"""[env.collectors.datadog-checks] [[envs.default.matrix]] -python = ["2.7", "{OLD_PYTHON_VERSION}"] +python = ["{OLD_PYTHON_VERSION}"] """, ) @@ -68,7 +70,6 @@ def fake_repo(tmp_path_factory, config_file, ddev): "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: {OLD_PYTHON_VERSION}", ] """, @@ -86,7 +87,6 @@ def fake_repo(tmp_path_factory, config_file, ddev): "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: {OLD_PYTHON_VERSION}", ] """, @@ -134,7 +134,6 @@ def fake_repo(tmp_path_factory, config_file, ddev): "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: {OLD_PYTHON_VERSION}", ] """, diff --git a/ddev/tests/cli/meta/scripts/test_upgrade_python.py b/ddev/tests/cli/meta/scripts/test_upgrade_python.py index 8302f47ec89ec..0f72910563c37 100644 --- a/ddev/tests/cli/meta/scripts/test_upgrade_python.py +++ b/ddev/tests/cli/meta/scripts/test_upgrade_python.py @@ -27,8 +27,8 @@ def test_upgrade_python(fake_repo, ddev): hatch_file = fake_repo.path / 'dummy' / 'hatch.toml' contents = hatch_file.read_text() - assert f'python = ["2.7", "{OLD_PYTHON_VERSION}"]' not in contents - assert f'python = ["2.7", "{NEW_PYTHON_VERSION}"]' in contents + assert f'python = ["{OLD_PYTHON_VERSION}"]' not in contents + assert f'python = ["{NEW_PYTHON_VERSION}"]' in contents for integration in ('dummy', 'datadog_checks_dependency_provider', 'logs_only'): pyproject_file = fake_repo.path / integration / 'pyproject.toml'