Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

conftest.py 1.1 KB

You have to be logged in to leave a comment. Sign In
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
  1. import sys
  2. import pytest
  3. import shutil
  4. from pathlib import Path
  5. from cookiecutter import main
  6. CCDS_ROOT = Path(__file__).parents[1].resolve()
  7. args = {
  8. 'project_name': 'DrivenData',
  9. 'author_name': 'DrivenData',
  10. 'open_source_license': 'BSD-3-Clause',
  11. 'python_interpreter': 'python'
  12. }
  13. def system_check(basename):
  14. platform = sys.platform
  15. if 'linux' in platform:
  16. basename = basename.lower()
  17. return basename
  18. @pytest.fixture(scope='class', params=[{}, args])
  19. def default_baked_project(tmpdir_factory, request):
  20. temp = tmpdir_factory.mktemp('data-project')
  21. out_dir = Path(temp).resolve()
  22. pytest.param = request.param
  23. main.cookiecutter(
  24. str(CCDS_ROOT),
  25. no_input=True,
  26. extra_context=pytest.param,
  27. output_dir=out_dir
  28. )
  29. pn = pytest.param.get('project_name') or 'project_name'
  30. # project name gets converted to lower case on Linux but not Mac
  31. pn = system_check(pn)
  32. proj = out_dir / pn
  33. request.cls.path = proj
  34. yield
  35. # cleanup after
  36. shutil.rmtree(out_dir)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...