mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-15 22:12:57 +00:00
Simplify test
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
from setuptools import setup
|
||||
from Cython.Build import cythonize
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
THIS_DIR = Path(__file__).parent.resolve()
|
||||
|
||||
|
||||
setup(ext_modules=cythonize(str(THIS_DIR / "helloworld.pyx")))
|
||||
setup(ext_modules=cythonize("helloworld.pyx"))
|
||||
|
@@ -3,8 +3,6 @@
|
||||
|
||||
import logging
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
from conftest import TrackedContainer
|
||||
|
||||
@@ -13,24 +11,18 @@ THIS_DIR = Path(__file__).parent.resolve()
|
||||
|
||||
|
||||
def test_cython(container: TrackedContainer) -> None:
|
||||
data_dir = THIS_DIR / "data/cython"
|
||||
|
||||
with tempfile.TemporaryDirectory() as host_data_dir:
|
||||
"""We create temporary dir with the same content to mount it as a writeable folder
|
||||
This allows to run this test in parallel many times
|
||||
"""
|
||||
shutil.copy(data_dir / "helloworld.pyx", host_data_dir)
|
||||
shutil.copy(data_dir / "setup.py", host_data_dir)
|
||||
|
||||
host_data_dir = THIS_DIR / "data/cython"
|
||||
cont_data_dir = "/home/jovyan/data"
|
||||
command = "sleep infinity"
|
||||
|
||||
running_container = container.run_detached(
|
||||
volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "rw"}},
|
||||
logs = container.run_and_wait(
|
||||
timeout=10,
|
||||
volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}},
|
||||
tty=True,
|
||||
command=["start.sh", "bash", "-c", command],
|
||||
command=[
|
||||
"start.sh",
|
||||
"bash",
|
||||
"-c",
|
||||
f"cp -r {cont_data_dir}/ /tmp/test/ && cd /tmp/test && python3 setup.py build_ext",
|
||||
],
|
||||
)
|
||||
command = f"python {cont_data_dir}/setup.py build_ext --inplace"
|
||||
cmd = running_container.exec_run(command)
|
||||
LOGGER.debug(cmd.output.decode("utf-8"))
|
||||
assert cmd.exit_code == 0, f"Command {command} failed"
|
||||
assert "building 'helloworld' extension" in logs
|
||||
|
Reference in New Issue
Block a user