Skip to content

Commit

Permalink
Improve assertions in test for python upgrade script (#18606)
Browse files Browse the repository at this point in the history
* Improve assertions in test for python upgrade script

* bump python version in conftest

* lint

---------

Co-authored-by: Kyle-Neale <[email protected]>
  • Loading branch information
iliakur and Kyle-Neale authored Sep 17, 2024
1 parent 2a419f7 commit d5250d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions ddev/tests/cli/meta/scripts/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"]
""",
)
Expand All @@ -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}",
]
""",
Expand All @@ -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}",
]
""",
Expand Down Expand Up @@ -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}",
]
""",
Expand Down
4 changes: 2 additions & 2 deletions ddev/tests/cli/meta/scripts/test_upgrade_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit d5250d3

Please sign in to comment.