11import subprocess
22import sys
33
4- from fair_python_cookiecutter .main import create_repository , CookiecutterConfig
5- from fair_python_cookiecutter .utils import TempDir
6-
7-
8- def sanity_check_project (proj_path ):
9- """Sanity-check a generated project (linters, tests, doc generation)."""
10- try :
11- subprocess .check_output (
12- "poetry install --with docs" .split (), cwd = proj_path , stderr = subprocess .PIPE
13- )
14- subprocess .check_output (
15- "poetry run poe lint --all-files" .split (),
16- cwd = proj_path ,
17- stderr = subprocess .PIPE ,
18- )
19- subprocess .check_output (
20- "poetry run poe test" .split (), cwd = proj_path , stderr = subprocess .PIPE
21- )
22- subprocess .check_output (
23- "poetry run poe docs" .split (), cwd = proj_path , stderr = subprocess .PIPE
24- )
25- except subprocess .CalledProcessError as e :
26- print ("exit code: {}" .format (e .returncode ))
27- print ("stderr: {}" .format (e .stderr .decode (sys .getfilesystemencoding ())))
4+ import pytest
285
29-
30- # def test_defaults(tmp_path):
31- # # generate with default values
32- # conf = CookiecutterConfig()
33- # dir = create_repository(conf, tmp_path)
34- # sanity_check_project(dir)
35-
36- # # should NOT have the code files
37- # assert not (dir / f"src/{DEMO_PROJ_SLUG}api.py").is_file()
38- # assert not (dir / f"src/{DEMO_PROJ_SLUG}/cli.py").is_file()
39- # assert not (dir / "tests/test_api.py").is_file()
40- # assert not (dir / "tests/test_cli.py").is_file()
41- # # and the expected license (MIT)
42- # first_license_line = open(dir / "LICENSE", "r").readline()
43- # assert first_license_line.find("MIT") >= 0
6+ from fair_python_cookiecutter .main import create_repository , CookiecutterConfig
447
458
469def test_configured (tmp_path ):
@@ -51,7 +14,6 @@ def test_configured(tmp_path):
5114 )
5215 DEMO_PROJ_PKG = "my_project"
5316 dir = create_repository (conf , tmp_path )
54- sanity_check_project (dir )
5517
5618 # should have the code files
5719 assert (dir / f"src/{ DEMO_PROJ_PKG } /api.py" ).is_file ()
0 commit comments