-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
executable file
·52 lines (40 loc) · 1.14 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
import shutil
import sys
from pathlib import Path
import pytest
from cookiecutter import main
CCDS_ROOT = Path(__file__).parents[1].resolve()
args = {
"project_name": "DrivenData",
"author_name": "DrivenData",
"email": "[email protected]",
"open_source_license": "BSD-3",
"python_version": "3.10",
"n_classes": "10",
"color_mode": "rgb",
}
def system_check(basename):
platform = sys.platform
if "linux" in platform:
basename = basename.lower()
return basename
@pytest.fixture(scope="class", params=[{}, args])
def default_baked_project(tmpdir_factory, request):
temp = tmpdir_factory.mktemp("data-project")
out_dir = Path(temp).resolve()
pytest.param = request.param
main.cookiecutter(
str(CCDS_ROOT),
no_input=True,
extra_context=pytest.param,
output_dir=out_dir,
default_config=True,
)
pn = pytest.param.get("project_name") or "project_name"
# project name gets converted to lower case on Linux but not Mac
pn = system_check(pn)
proj = out_dir / pn
request.cls.path = proj
yield
# cleanup after
shutil.rmtree(out_dir)