File: test_distribution.py

package info (click to toggle)
scikit-build 0.18.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,792 kB
  • sloc: python: 5,258; cpp: 284; makefile: 171; f90: 12; sh: 7
file content (43 lines) | stat: -rw-r--r-- 1,299 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
32
33
34
35
36
37
38
39
40
41
42
43
from __future__ import annotations

from pathlib import Path

import pytest

from . import initialize_git_repo_and_commit, prepare_project

DIR = Path(__file__).parent.resolve()


@pytest.mark.isolated()
def test_source_distribution(isolated, tmp_path):
    sdist_dir = tmp_path / "dist"
    workspace = tmp_path / "workspace"
    workspace.mkdir()
    isolated.install("build[virtualenv]")
    isolated.module("build", "--sdist", "--outdir", sdist_dir, cwd=DIR.parent)
    (sdist,) = sdist_dir.glob("*.tar.gz")

    isolated.install(sdist)

    prepare_project("hello-no-language", str(workspace), force=True)
    initialize_git_repo_and_commit(str(workspace), verbose=False)

    isolated.run("python", "setup.py", "bdist_wheel", cwd=workspace)


@pytest.mark.isolated()
def test_wheel(isolated, tmp_path):
    wheel_dir = tmp_path / "dist"
    workspace = tmp_path / "workspace"
    workspace.mkdir()
    isolated.install("build[virtualenv]")
    isolated.module("build", "--wheel", "--outdir", wheel_dir, cwd=DIR.parent)
    (wheel,) = wheel_dir.glob("*.whl")

    isolated.install(wheel)

    prepare_project("hello-no-language", str(workspace), force=True)
    initialize_git_repo_and_commit(str(workspace), verbose=False)

    isolated.run("python", "setup.py", "bdist_wheel", cwd=workspace)