File tree 4 files changed +35
-2
lines changed
4 files changed +35
-2
lines changed Original file line number Diff line number Diff line change
1
+ Fix ``--sdistonly `` behaviour.
Original file line number Diff line number Diff line change @@ -299,7 +299,11 @@ def _queue_and_wait(
299
299
300
300
def _run (tox_env : RunToxEnv ) -> ToxEnvRunResult :
301
301
spinner .add (tox_env .conf .name )
302
- return run_one (tox_env , options .parsed .no_test , suspend_display = live is False )
302
+ return run_one (
303
+ tox_env ,
304
+ options .parsed .no_test or options .parsed .package_only ,
305
+ suspend_display = live is False ,
306
+ )
303
307
304
308
try :
305
309
executor = ThreadPoolExecutor (max_workers = max_workers , thread_name_prefix = "tox-driver" )
Original file line number Diff line number Diff line change @@ -165,7 +165,8 @@ def _register_package_conf(self) -> bool:
165
165
166
166
def _setup_pkg (self ) -> None :
167
167
self ._packages = self ._build_packages ()
168
- self ._install (self ._packages , RunToxEnv .__name__ , "package" )
168
+ if not self .options .package_only :
169
+ self ._install (self ._packages , RunToxEnv .__name__ , "package" )
169
170
self ._handle_journal_package (self .journal , self ._packages )
170
171
171
172
@staticmethod
Original file line number Diff line number Diff line change
1
+ from pathlib import Path
2
+
3
+ from tox .pytest import ToxProjectCreator
4
+
5
+
6
+ def test_package_only (
7
+ tox_project : ToxProjectCreator ,
8
+ demo_pkg_inline : Path ,
9
+ ) -> None :
10
+ ini = "[testenv]\n commands = python -c 'print('foo')'"
11
+ proj = tox_project (
12
+ {"tox.ini" : ini , "pyproject.toml" : (demo_pkg_inline / "pyproject.toml" ).read_text ()},
13
+ base = demo_pkg_inline ,
14
+ )
15
+ execute_calls = proj .patch_execute (lambda r : 0 if "install" in r .run_id else None )
16
+ result = proj .run ("r" , "--sdistonly" )
17
+ result .assert_success ()
18
+
19
+ expected_calls = [
20
+ (".pkg" , "_optional_hooks" ),
21
+ (".pkg" , "get_requires_for_build_sdist" ),
22
+ (".pkg" , "build_wheel" ),
23
+ (".pkg" , "build_sdist" ),
24
+ (".pkg" , "_exit" ),
25
+ ]
26
+ found_calls = [(i [0 ][0 ].conf .name , i [0 ][3 ].run_id ) for i in execute_calls .call_args_list ]
27
+ assert found_calls == expected_calls
You can’t perform that action at this time.
0 commit comments