File: test_custom_modules.py

package info (click to toggle)
scikit-build-core 0.11.1-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,408 kB
  • sloc: python: 13,380; ansic: 140; cpp: 134; sh: 27; fortran: 18; makefile: 7
file content (31 lines) | stat: -rw-r--r-- 925 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from __future__ import annotations

import sys
from pathlib import Path

import pytest

DIR = Path(__file__).parent
PROJECT_DIR = DIR / "packages" / "custom_cmake"


def test_ep(isolated):
    isolated.install("hatchling", "scikit-build-core")
    isolated.install(PROJECT_DIR / "extern", isolated=False)
    isolated.install(PROJECT_DIR, "-v", isolated=False)

    if sys.platform.startswith("win"):
        # TODO: maybe figure out how to make this work on windows?
        pytest.skip("Can't run script on Windows")

    script = isolated.run("script1", capture=True).strip()
    pysys = isolated.execute("import sys; print(sys.executable)").strip()
    contents = Path(script).read_text(encoding="utf-8")
    assert contents.startswith(f"#!{pysys}")

    assert (
        isolated.execute(
            "from importlib import metadata; print(metadata.version('custom_modules'), end='')"
        )
        == "2.3.4"
    )