@@ -596,19 +596,36 @@ def build(options: Options, tmp_path: Path) -> None:
596
596
597
597
test_command_parts = shlex .split (build_options .test_command )
598
598
if test_command_parts [0 :2 ] != ["python" , "-m" ]:
599
- log .warning (
600
- unwrap_preserving_paragraphs (f"""
601
- iOS tests configured with a test command which doesn't start with
602
- 'python -m'. iOS tests must execute python modules - other
603
- entrypoints are not supported.
604
-
605
- cibuildwheel will try to execute it as if it started with 'python
606
- -m'. If this works, all you need to do is add that to your test
607
- command.
608
-
609
- Test command: { build_options .test_command }
610
- """ )
599
+ first_part = test_command_parts [0 ]
600
+ first_arg_looks_like_a_module_name = all (
601
+ n .isidentifier () for n in first_part .split ("." )
611
602
)
603
+ if first_arg_looks_like_a_module_name :
604
+ log .warning (
605
+ unwrap_preserving_paragraphs (f"""
606
+ iOS tests configured with a test command which doesn't start
607
+ with 'python -m'. iOS tests must execute python modules - other
608
+ entrypoints are not supported.
609
+
610
+ cibuildwheel will try to execute it as if it started with
611
+ 'python -m'. If this works, all you need to do is add that to
612
+ your test command.
613
+
614
+ Test command: { build_options .test_command }
615
+ """ )
616
+ )
617
+ else :
618
+ # no point in trying to run it as a module - it's not a module
619
+ msg = unwrap_preserving_paragraphs (
620
+ f"""
621
+ iOS tests configured with a test command which doesn't start
622
+ with 'python -m'. iOS tests must execute python modules - other
623
+ entrypoints are not supported.
624
+
625
+ Test command: { build_options .test_command }
626
+ """
627
+ )
628
+ raise errors .FatalError (msg )
612
629
else :
613
630
# the testbed run command actually doesn't want the
614
631
# python -m prefix - it's implicit, so we remove it
0 commit comments