File: conftest.py

package info (click to toggle)
pdm-backend 2.4.5%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,124 kB
  • sloc: python: 2,833; ansic: 21; makefile: 5; sh: 1
file content (30 lines) | stat: -rw-r--r-- 913 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
import shutil
import subprocess
from pathlib import Path

import pytest

from tests import FIXTURES


@pytest.fixture
def fixture_project(tmp_path: Path, name: str, monkeypatch: pytest.MonkeyPatch) -> Path:
    project = FIXTURES / "projects" / name
    shutil.copytree(project, tmp_path / name)
    monkeypatch.chdir(tmp_path / name)
    return tmp_path / name


@pytest.fixture
def dist(tmp_path: Path) -> Path:
    return tmp_path / "dist"


@pytest.fixture
def scm(fixture_project: Path) -> None:
    subprocess.check_call(["git", "config", "--global", "user.email", "you@example.com"])
    subprocess.check_call(["git", "config", "--global", "user.name", "Your Name"])
    subprocess.check_call(["git", "init"])
    subprocess.check_call(["git", "add", "."])
    subprocess.check_call(["git", "commit", "-m", "initial commit"])
    subprocess.check_call(["git", "tag", "-a", "0.1.0", "-m", "version 0.1.0"])