@@ -84,22 +84,25 @@ def sdist(pyproject_build_args):
8484 spin .util .run (["tools/check_sdist.py" , sdist ])
8585
8686
87+ _SRC_IN_TEST_ARGS_WARNING_MESSAGE = """\
88+ WARNING: Found 'src' in test arguments and using out-of-tree build.
89+ For out-of-tree builds, selecting `src/` as a doctest path may fail because
90+ Pytest doesn't expect source and installation to live in different places.
91+ Use an editable install (`spin install`) which supports this or avoid passing
92+ `src/`. For example:
93+ spin test -- src/skimage/io # NO!
94+ spin test -- skimage.io # YES!
95+ """
96+
97+
8798@click .option ("--doctest/--no-doctest" , default = True , help = "Whether to run doctests." )
8899@spin .util .extend_command (spin .cmds .meson .test )
89100def test (* , parent_callback , doctest = False , ** kwargs ):
90101 pytest_args = kwargs .get ('pytest_args' , ())
91102
92103 is_out_of_tree_build = not _is_editable_install_of_same_source ("scikit-image" )
93104 if is_out_of_tree_build and "src" in str (pytest_args ):
94- click .secho (
95- "WARN: Found 'src' in test arguments and using out-of-tree build. "
96- "For out-of-tree builds, selecting `src/` as a test path fails. "
97- "Pytest doesn't expect test sources and installation to be different. "
98- "Avoid passing `src/` or use an editable install (`spin install`) "
99- "to avoid this." ,
100- fg = "yellow" ,
101- bold = True ,
102- )
105+ click .secho (_SRC_IN_TEST_ARGS_WARNING_MESSAGE , fg = "yellow" , bold = True )
103106
104107 if doctest :
105108 if '--doctest-plus' not in pytest_args :
0 commit comments