Skip to content

Commit 03a45ef

Browse files
committed
TST: improve editable install tests
Use the correct build command to setup the editable package import and enable editable install verbose mode to make package rebuild errors easier to debug.
1 parent 17074b1 commit 03a45ef

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/test_editable.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ def test_collect(package_complex):
7777

7878
def test_mesonpy_meta_finder(package_complex, tmp_path):
7979
# build a package in a temporary directory
80-
mesonpy.Project(package_complex, tmp_path)
80+
project = mesonpy.Project(package_complex, tmp_path)
8181

8282
# point the meta finder to the build directory
83-
finder = _editable.MesonpyMetaFinder('complex', {'complex'}, os.fspath(tmp_path), ['ninja'])
83+
finder = _editable.MesonpyMetaFinder('complex', {'complex'}, os.fspath(tmp_path), project._build_command, True)
8484

8585
# check repr
8686
assert repr(finder) == f'MesonpyMetaFinder(\'complex\', {str(tmp_path)!r})'
@@ -141,10 +141,10 @@ def test_mesonpy_traversable():
141141
def test_resources(tmp_path):
142142
# build a package in a temporary directory
143143
package_path = pathlib.Path(__file__).parent / 'packages' / 'simple'
144-
mesonpy.Project(package_path, tmp_path)
144+
project = mesonpy.Project(package_path, tmp_path)
145145

146146
# point the meta finder to the build directory
147-
finder = _editable.MesonpyMetaFinder('simple', {'simple'}, os.fspath(tmp_path), ['ninja'])
147+
finder = _editable.MesonpyMetaFinder('simple', {'simple'}, os.fspath(tmp_path), project._build_command, True)
148148

149149
# verify that we can look up resources
150150
spec = finder.find_spec('simple')
@@ -160,10 +160,10 @@ def test_resources(tmp_path):
160160
def test_importlib_resources(tmp_path):
161161
# build a package in a temporary directory
162162
package_path = pathlib.Path(__file__).parent / 'packages' / 'simple'
163-
mesonpy.Project(package_path, tmp_path)
163+
project = mesonpy.Project(package_path, tmp_path)
164164

165165
# point the meta finder to the build directory
166-
finder = _editable.MesonpyMetaFinder('simple', {'simple'}, os.fspath(tmp_path), ['ninja'])
166+
finder = _editable.MesonpyMetaFinder('simple', {'simple'}, os.fspath(tmp_path), project._build_command, True)
167167

168168
try:
169169
# install the finder in the meta path
@@ -210,9 +210,9 @@ def test_editble_reentrant(venv, editable_imports_itself_during_build):
210210

211211
def test_editable_pkgutils_walk_packages(package_complex, tmp_path):
212212
# build a package in a temporary directory
213-
mesonpy.Project(package_complex, tmp_path)
213+
project = mesonpy.Project(package_complex, tmp_path)
214214

215-
finder = _editable.MesonpyMetaFinder('complex', {'complex'}, os.fspath(tmp_path), ['ninja'])
215+
finder = _editable.MesonpyMetaFinder('complex', {'complex'}, os.fspath(tmp_path), project._build_command, True)
216216

217217
try:
218218
# install editable hooks
@@ -244,8 +244,8 @@ def test_editable_pkgutils_walk_packages(package_complex, tmp_path):
244244

245245

246246
def test_custom_target_install_dir(package_custom_target_dir, tmp_path):
247-
mesonpy.Project(package_custom_target_dir, tmp_path)
248-
finder = _editable.MesonpyMetaFinder('package', {'package'}, os.fspath(tmp_path), ['ninja'])
247+
project = mesonpy.Project(package_custom_target_dir, tmp_path)
248+
finder = _editable.MesonpyMetaFinder('package', {'package'}, os.fspath(tmp_path), project._build_command, True)
249249
try:
250250
sys.meta_path.insert(0, finder)
251251
import package.generated.one

0 commit comments

Comments
 (0)