From c0a7cc5f25cd6668fe2648bf8e00f00d4af02716 Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Sun, 24 Dec 2023 10:52:05 +0000 Subject: [PATCH] Update expected error message for new version of setuptools --- .../app/sdist_native/pyproject.toml | 1 + .../src/test/integration/test_gradle_plugin.py | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/product/gradle-plugin/src/test/integration/data/PythonReqs/sdist_native_pep517/app/sdist_native/pyproject.toml b/product/gradle-plugin/src/test/integration/data/PythonReqs/sdist_native_pep517/app/sdist_native/pyproject.toml index 9787c3bdf0..a2bc636b86 100644 --- a/product/gradle-plugin/src/test/integration/data/PythonReqs/sdist_native_pep517/app/sdist_native/pyproject.toml +++ b/product/gradle-plugin/src/test/integration/data/PythonReqs/sdist_native_pep517/app/sdist_native/pyproject.toml @@ -1,3 +1,4 @@ [build-system] +# Leave the requirements unpinned, so we always test against the current versions. requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" diff --git a/product/gradle-plugin/src/test/integration/test_gradle_plugin.py b/product/gradle-plugin/src/test/integration/test_gradle_plugin.py index 4ee7ca3004..71ae618346 100644 --- a/product/gradle-plugin/src/test/integration/test_gradle_plugin.py +++ b/product/gradle-plugin/src/test/integration/test_gradle_plugin.py @@ -1150,13 +1150,16 @@ def sdist_native(self, name): url = r"file:.*app/sdist_native" if name in ["sdist_native_compiler", "sdist_native_cc"]: - # These tests fail at the egg_info stage, so the name and version are - # unavailable. + # These tests fail at the egg_info stage, so the name and version + # are unavailable. req_str = url else: # These tests fail at the bdist_wheel stage, so the name and version - # have been obtained from egg_info. - req_str = f"{name.replace('_', '-')}==1.0 from {url}" + # have been obtained from egg_info. But how the name is formatted + # depends on whether we're using our bundled version of setuptools, + # or the current one from PyPI. + name_str = name if pep517 else name.replace('_', '-') + req_str = f"{name_str}==1.0 from {url}" self.assertInLong(fr"Failed to install {req_str}." + self.tracker_advice() + r"$", run.stderr, re=True)