Skip to content

Commit

Permalink
Reproduce issue with Meson + editable mode in test_meson.py
Browse files Browse the repository at this point in the history
  • Loading branch information
paugier committed Feb 14, 2024
1 parent 867ad23 commit c6e17df
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from transonic import boost
from transonic import boost, Transonic

# used for testing
ts = Transonic()


@boost
Expand Down
20 changes: 19 additions & 1 deletion tests/test_meson.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ def run_in_venv(venv, command, cwd=None):
subprocess.run(args, cwd=cwd, check=True, env=env)


def eval_in_venv(venv, code):
process = subprocess.run(
[venv.python, "-c", code],
env=venv.env,
check=True,
capture_output=True,
text=True,
encoding="utf-8",
)
return process.stdout


@pytest.mark.xfail(
sys.platform.startswith("win"), reason="Buggy on Windows (TODO: debug)"
)
Expand Down Expand Up @@ -89,7 +101,7 @@ def test_install_package(tmpdir, venv):
if backend_default == "pythran":
run_in_venv(venv, "pip install pythran")

install_command = "pip install . --no-build-isolation"
install_command = "pip install -e . --no-build-isolation"
if backend_default == "python":
install_command += (
" --config-settings=setup-args=-Dtransonic-backend=python"
Expand All @@ -98,6 +110,12 @@ def test_install_package(tmpdir, venv):
run_in_venv(venv, install_command, cwd=tmpdir)
run_in_venv(venv, "pytest tests", cwd=tmpdir)

out = eval_in_venv(
venv, "from package_for_test_meson.foo import ts; print(ts.is_compiled)"
).strip()
is_compiled = out == "True"
assert is_compiled


@pytest.mark.skipif(nb_proc > 1, reason="No commandline in MPI")
@pytest.mark.xfail(backend_default == "cython", reason="Not yet implemented")
Expand Down

0 comments on commit c6e17df

Please sign in to comment.