-
Notifications
You must be signed in to change notification settings - Fork 157
/
Copy pathconftest.py
66 lines (54 loc) · 1.69 KB
/
conftest.py
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"""
pytest local configuration plug-in
"""
from __future__ import annotations
import os.path
import subprocess
import sys
import sysconfig
import pytest
@pytest.fixture(scope="session")
def wheels_and_eggs(tmp_path_factory):
"""Build wheels and eggs from test distributions."""
test_distributions = (
"complex-dist",
"simple.dist",
"headers.dist",
"commasinfilenames.dist",
"unicode.dist",
)
if sys.platform != "win32" and sysconfig.get_config_var("Py_GIL_DISABLED") != 1:
# ABI3 extensions don't really work on Windows
test_distributions += ("abi3extension.dist",)
pwd = os.path.abspath(os.curdir)
this_dir = os.path.dirname(__file__)
build_dir = tmp_path_factory.mktemp("build")
dist_dir = tmp_path_factory.mktemp("dist")
for dist in test_distributions:
os.chdir(os.path.join(this_dir, "testdata", dist))
subprocess.check_call(
[
sys.executable,
"setup.py",
"bdist_egg",
"-b",
str(build_dir),
"-d",
str(dist_dir),
"bdist_wheel",
"-b",
str(build_dir),
"-d",
str(dist_dir),
]
)
os.chdir(pwd)
return sorted(
str(fname) for fname in dist_dir.iterdir() if fname.suffix in (".whl", ".egg")
)
@pytest.fixture(scope="session")
def wheel_paths(wheels_and_eggs):
return [fname for fname in wheels_and_eggs if fname.endswith(".whl")]
@pytest.fixture(scope="session")
def egg_paths(wheels_and_eggs):
return [fname for fname in wheels_and_eggs if fname.endswith(".egg")]