Repository: pypa/twine

Issue:
Some f-strings are missing the `f`
### Is there an existing issue for this?

- [x] I have searched the existing issues (open and closed), and could not find an existing issue

### What keywords did you use to search existing issues?

f-string

### What operating system are you using?

macOS

### If you selected 'Other', describe your Operating System here

_No response_

### What version of Python are you running?

```console
Python 3.12.6
```

### How did you install twine? Did you use your operating system's package manager or pip or something else?

```console
python -m pip install twine
```

### What version of twine do you have installed (include the complete output)

```console
twine version 0.1.dev1312+gaa3a910 (keyring: 24.1.1, packaging: 24.2, requests: 2.32.3, requests-toolbelt: 1.0.0, urllib3: 2.2.2, id: 1.5.0)
```

### Which package repository are you using?

pypi

### Please describe the issue that you are experiencing

Hi folks,

While running various twine commands (e.g. `check` or `publish`) I see the filename missing from the error message. For example:

Message:
```python      
Checking my_sdist.tar.gz: ERROR    InvalidDistribution: Too many top-level members in sdist archive: {self.filename} 
```

This happens because there is a missing `f` in the [sdist.py module](https://github.com/pypa/twine/blob/main/twine/sdist.py#L72).
There are also a couple of other occurrences of a missing `f`; I've reflected those in unit tests I've written in the attached PR.

### Please list the steps required to reproduce this behaviour

```python
1. python -m pip install twine
2. manufacture an sdist that happens to contain 2 files:
    tar czf my_sdist.tar.gz my_project some_other_file
python -m twine check --strict my_sdist.tar.gz
```


### Anything else you'd like to mention?

Thank you for all you do for Python. Cheers!

Discussion hints:

Solution patch:
diff --git a/changelog/1224.bugfix.rst b/changelog/1224.bugfix.rst
new file mode 100644
index 0000000..7883dcc
--- /dev/null
+++ b/changelog/1224.bugfix.rst
@@ -0,0 +1,1 @@
+Fix a couple of incorrectly rendered error messages.
diff --git a/twine/sdist.py b/twine/sdist.py
index 4808e88..06a121e 100644
--- a/twine/sdist.py
+++ b/twine/sdist.py
@@ -40,14 +40,14 @@ class TarGzSDist(SDist):
             root = os.path.commonpath(sdist.getnames())
             if root in {".", "/", ""}:
                 raise exceptions.InvalidDistribution(
-                    "Too many top-level members in sdist archive: {self.filename}"
+                    f"Too many top-level members in sdist archive: {self.filename}"
                 )
             # ...containing the package metadata in a ``PKG-INFO`` file.
             with suppress(KeyError):
                 member = sdist.getmember(root.rstrip("/") + "/PKG-INFO")
                 if not member.isfile():
                     raise exceptions.InvalidDistribution(
-                        "PKG-INFO is not a regular file: {self.filename}"
+                        f"PKG-INFO is not a regular file: {self.filename}"
                     )
                 fd = sdist.extractfile(member)
                 assert fd is not None, "for mypy"
@@ -69,7 +69,7 @@ class ZipSDist(SDist):
             root = os.path.commonpath(sdist.namelist())
             if root in {".", "/", ""}:
                 raise exceptions.InvalidDistribution(
-                    "Too many top-level members in sdist archive: {self.filename}"
+                    f"Too many top-level members in sdist archive: {self.filename}"
                 )
             # ...containing the package metadata in a ``PKG-INFO`` file.
             with suppress(KeyError):


Test patch:
diff --git a/tests/test_sdist.py b/tests/test_sdist.py
index a619dfe..da8fa23 100644
--- a/tests/test_sdist.py
+++ b/tests/test_sdist.py
@@ -141,7 +141,10 @@ def test_pkg_info_not_regular_file(tmp_path):
         },
     )
 
-    with pytest.raises(exceptions.InvalidDistribution, match="PKG-INFO is not a reg"):
+    with pytest.raises(
+        exceptions.InvalidDistribution,
+        match=r"^PKG-INFO is not a reg.*test-1.2.3.tar.gz$",
+    ):
         sdist.SDist(str(filepath)).read()
 
 
@@ -162,7 +165,10 @@ def test_multiple_top_level(archive_format, tmp_path):
         },
     )
 
-    with pytest.raises(exceptions.InvalidDistribution, match="Too many top-level"):
+    with pytest.raises(
+        exceptions.InvalidDistribution,
+        match=r"^Too many top-level.*test-1.2.3.(tar.gz|zip)$",
+    ):
         sdist.SDist(str(filepath)).read()