|
29 | 29 |
|
30 | 30 |
|
31 | 31 | @pytest.fixture
|
32 |
| -def install_temp(request, tmp_path): |
| 32 | +def install_temp(tmp_path): |
33 | 33 | # Based in part on test_cython from random.tests.test_extending
|
34 | 34 | if IS_WASM:
|
35 | 35 | pytest.skip("No subprocess")
|
36 | 36 |
|
37 |
| - here = os.path.dirname(__file__) |
38 |
| - ext_dir = os.path.join(here, "examples", "cython") |
39 |
| - |
40 |
| - cytest = str(tmp_path / "cytest") |
41 |
| - |
42 |
| - shutil.copytree(ext_dir, cytest) |
43 |
| - # build the examples and "install" them into a temporary directory |
44 |
| - |
45 |
| - install_log = str(tmp_path / "tmp_install_log.txt") |
46 |
| - subprocess.check_output( |
47 |
| - [ |
48 |
| - sys.executable, |
49 |
| - "setup.py", |
50 |
| - "build", |
51 |
| - "install", |
52 |
| - "--prefix", str(tmp_path / "installdir"), |
53 |
| - "--single-version-externally-managed", |
54 |
| - "--record", |
55 |
| - install_log, |
56 |
| - ], |
57 |
| - cwd=cytest, |
58 |
| - ) |
59 |
| - |
60 |
| - # In order to import the built module, we need its path to sys.path |
61 |
| - # so parse that out of the record |
62 |
| - with open(install_log) as fid: |
63 |
| - for line in fid: |
64 |
| - if "checks" in line: |
65 |
| - sys.path.append(os.path.dirname(line)) |
66 |
| - break |
67 |
| - else: |
68 |
| - raise RuntimeError(f'could not parse "{install_log}"') |
69 |
| - |
| 37 | + srcdir = os.path.join(os.path.dirname(__file__), 'examples', 'cython') |
| 38 | + build_dir = tmp_path / "build" |
| 39 | + os.makedirs(build_dir, exist_ok=True) |
| 40 | + try: |
| 41 | + subprocess.check_call(["meson", "--version"]) |
| 42 | + except FileNotFoundError: |
| 43 | + pytest.skip("No usable 'meson' found") |
| 44 | + if sys.platform == "win32": |
| 45 | + subprocess.check_call(["meson", "setup", |
| 46 | + "--buildtype=release", |
| 47 | + "--vsenv", str(srcdir)], |
| 48 | + cwd=build_dir, |
| 49 | + ) |
| 50 | + else: |
| 51 | + subprocess.check_call(["meson", "setup", str(srcdir)], |
| 52 | + cwd=build_dir |
| 53 | + ) |
| 54 | + subprocess.check_call(["meson", "compile", "-vv"], cwd=build_dir) |
| 55 | + |
| 56 | + sys.path.append(str(build_dir)) |
70 | 57 |
|
71 | 58 | def test_is_timedelta64_object(install_temp):
|
72 | 59 | import checks
|
|
0 commit comments