File tree Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change 11import getpass
22import logging .config
3+ import pathlib
4+ import tempfile
35import textwrap
46
57import pytest
810from twine import settings
911from twine import utils
1012
13+ from .helpers import build_sdist
14+ from .helpers import build_wheel
15+
1116
1217@pytest .fixture (autouse = True )
1318def configure_output ():
@@ -83,3 +88,31 @@ def _settings(config=default_config, **settings_kwargs):
8388@pytest .fixture
8489def entered_password (monkeypatch ):
8590 monkeypatch .setattr (getpass , "getpass" , lambda prompt : "entered pw" )
91+
92+
93+ @pytest .fixture (scope = "session" )
94+ def tmp_path_session (tmp_path_factory ):
95+ return pathlib .Path (
96+ tempfile .mkdtemp (
97+ prefix = "twine-test-" ,
98+ dir = tmp_path_factory .mktemp ("test" ),
99+ )
100+ )
101+
102+
103+ @pytest .fixture
104+ def test_wheel (tmp_path_session ):
105+ return build_wheel (tmp_path_session , "test" , "1.2.3" , {})
106+
107+
108+ @pytest .fixture
109+ def test_wheel_signature (test_wheel ):
110+ signature = test_wheel .with_suffix (".whl.asc" )
111+ signature .write_text ("-----BEGIN PGP SIGNATURE-----" )
112+ yield signature
113+ signature .unlink ()
114+
115+
116+ @pytest .fixture
117+ def test_sdist (tmp_path_session ):
118+ return build_sdist (tmp_path_session , "test" , "1.2.3" , {})
Original file line number Diff line number Diff line change @@ -116,8 +116,8 @@ def test_package_signed_name_is_correct():
116116 assert package .signed_filename == (filename + ".asc" )
117117
118118
119- def test_package_add_attestations (tmp_path ):
120- package = package_file .PackageFile .from_filename (helpers . WHEEL_FIXTURE , None )
119+ def test_package_add_attestations (tmp_path , test_wheel ):
120+ package = package_file .PackageFile .from_filename (test_wheel , None )
121121
122122 assert package .attestations is None
123123
You can’t perform that action at this time.
0 commit comments