From 02910939fb77e2318a5485ab3fc5fe34def11acd Mon Sep 17 00:00:00 2001 From: Devesh Kumar Singh Date: Wed, 22 Apr 2020 15:15:59 +0530 Subject: [PATCH] Reword error message in wheel and wininst read (#601) * Reword error message in wheel and wininst read * Updated invalid while error msg in wheel test --- tests/test_wheel.py | 3 ++- twine/wheel.py | 4 +++- twine/wininst.py | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/test_wheel.py b/tests/test_wheel.py index e85fdb64..af24c73c 100644 --- a/tests/test_wheel.py +++ b/tests/test_wheel.py @@ -77,7 +77,8 @@ def test_read_invalid_wheel_extension(): file_name = os.path.join(os.path.dirname(__file__), "fixtures/twine-1.5.0.tar.gz") with pytest.raises( - exceptions.InvalidDistribution, match=f"Not a known archive format: {file_name}" + exceptions.InvalidDistribution, + match=f"Not a known archive format for file: {file_name}", ): wheel.Wheel(file_name) diff --git a/twine/wheel.py b/twine/wheel.py index acdbc6c2..a601caec 100644 --- a/twine/wheel.py +++ b/twine/wheel.py @@ -64,7 +64,9 @@ def read_file(name): return archive.read(name) else: - raise exceptions.InvalidDistribution("Not a known archive format: %s" % fqn) + raise exceptions.InvalidDistribution( + "Not a known archive format for file: %s" % fqn + ) try: for path in self.find_candidate_metadata_files(names): diff --git a/twine/wininst.py b/twine/wininst.py index 8b1fb666..b93cea1c 100644 --- a/twine/wininst.py +++ b/twine/wininst.py @@ -36,7 +36,9 @@ def read_file(name): return archive.read(name) else: - raise exceptions.InvalidDistribution("Not a known archive format: %s" % fqn) + raise exceptions.InvalidDistribution( + "Not a known archive format for file: %s" % fqn + ) try: tuples = [