Skip to content

Commit

Permalink
Use literal file names in test_commands
Browse files Browse the repository at this point in the history
There is no need for the strings to be real file paths. Using
string literals makes the test obvious to follow. This continues the
work aimed at removing the binary test artifacts from the repository.
  • Loading branch information
dnicolodi committed Jan 10, 2025
1 parent 4406034 commit 41f44cc
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest

from tests import helpers
from twine import commands
from twine import exceptions

Expand Down Expand Up @@ -55,38 +54,39 @@ def test_find_dists_handles_real_files():
def test_split_inputs():
"""Split inputs into dists, signatures, and attestations."""
inputs = [
helpers.WHEEL_FIXTURE,
helpers.WHEEL_FIXTURE + ".asc",
helpers.WHEEL_FIXTURE + ".build.attestation",
helpers.WHEEL_FIXTURE + ".publish.attestation",
helpers.SDIST_FIXTURE,
helpers.SDIST_FIXTURE + ".asc",
helpers.NEW_WHEEL_FIXTURE,
helpers.NEW_WHEEL_FIXTURE + ".frob.attestation",
helpers.NEW_SDIST_FIXTURE,
"dist/twine-1.5.0-py2.py3-none-any.whl",
"dist/twine-1.5.0-py2.py3-none-any.whl.asc",
"dist/twine-1.5.0-py2.py3-none-any.whl.build.attestation",
"dist/twine-1.5.0-py2.py3-none-any.whl.build.publish.attestation",
"dist/twine-1.5.0.tar.gz",
"dist/twine-1.5.0.tar.gz.asc",
"dist/twine-1.6.5-py2.py3-none-any.whl",
"dist/twine-1.6.5-py2.py3-none-any.whl.frob.attestation",
"dist/twine-1.6.5.tar.gz",
]

inputs = commands._split_inputs(inputs)

assert inputs.dists == [
helpers.WHEEL_FIXTURE,
helpers.SDIST_FIXTURE,
helpers.NEW_WHEEL_FIXTURE,
helpers.NEW_SDIST_FIXTURE,
"dist/twine-1.5.0-py2.py3-none-any.whl",
"dist/twine-1.5.0.tar.gz",
"dist/twine-1.6.5-py2.py3-none-any.whl",
"dist/twine-1.6.5.tar.gz",
]

expected_signatures = {
os.path.basename(dist) + ".asc": dist + ".asc"
for dist in [helpers.WHEEL_FIXTURE, helpers.SDIST_FIXTURE]
assert inputs.signatures == {
"twine-1.5.0-py2.py3-none-any.whl.asc": "dist/twine-1.5.0-py2.py3-none-any.whl.asc", # noqa: E501
"twine-1.5.0.tar.gz.asc": "dist/twine-1.5.0.tar.gz.asc",
}
assert inputs.signatures == expected_signatures

assert inputs.attestations_by_dist == {
helpers.WHEEL_FIXTURE: [
helpers.WHEEL_FIXTURE + ".build.attestation",
helpers.WHEEL_FIXTURE + ".publish.attestation",
"dist/twine-1.5.0-py2.py3-none-any.whl": [
"dist/twine-1.5.0-py2.py3-none-any.whl.build.attestation",
"dist/twine-1.5.0-py2.py3-none-any.whl.build.publish.attestation",
],
helpers.SDIST_FIXTURE: [],
helpers.NEW_WHEEL_FIXTURE: [helpers.NEW_WHEEL_FIXTURE + ".frob.attestation"],
helpers.NEW_SDIST_FIXTURE: [],
"dist/twine-1.5.0.tar.gz": [],
"dist/twine-1.6.5-py2.py3-none-any.whl": [
"dist/twine-1.6.5-py2.py3-none-any.whl.frob.attestation",
],
"dist/twine-1.6.5.tar.gz": [],
}

0 comments on commit 41f44cc

Please sign in to comment.