def test_mkdocs_build(cookies: Cookies) -> None: """Mkdocs must be able to build documentation for baked project.""" result = cookies.bake(extra_context={}) expected = 0 process = run_command(command="poetry install", work_dir=result.project_path) # Poetry prints errors to stdout instead of stderr. assert process.returncode == expected, process.stdout.decode("utf-8") process = run_command(command="poetry run mkdocs build", work_dir=result.project_path) assert process.returncode == expected, process.stderr.decode("utf-8")
def test_pytest_test(cookies: Cookies) -> None: """Generated files must pass Pytest unit tests.""" result = cookies.bake(extra_context={}) expected = 0 process = run_command(command="poetry install", work_dir=result.project_path) # Poetry prints errors to stdout instead of stderr. assert process.returncode == expected, process.stdout.decode("utf-8") process = run_command(command="poetry run pytest", work_dir=result.project_path) # Pytest prints errors to stdout instead of stderr. assert process.returncode == expected, process.stdout.decode("utf-8")
def test_prettier_format(cookies: Cookies) -> None: """Generated files must pass Prettier format checker.""" result = cookies.bake(extra_context={}) proj_dir = result.project_path process = run_command(command="prettier --check .", work_dir=proj_dir) assert process.returncode == 0, process.stderr.decode("utf-8")
def test_black_format(baked_project: Result) -> None: """Generated files must pass Black format checker.""" process = run_command(command="black -l 80 --check .", work_dir=baked_project.project_path) expected = 0 actual = process.returncode assert actual == expected, process.stderr.decode("utf-8")
def test_flake8_lints(baked_project: Result) -> None: """Generated files must pass Flake8 lints.""" process = run_command( command="flake8 .", work_dir=baked_project.project_path, ) expected = 0 actual = process.returncode # Flake8 prints errors to stdout instead of stderr. assert actual == expected, process.stdout.decode("utf-8")
def test_mypy_type_checks(baked_project: Result) -> None: """Generated files must pass Mypy type checks.""" process = run_command( command="mypy --install-types --non-interactive .", work_dir=baked_project.project_path, ) expected = 0 actual = process.returncode # Mypy prints errors to stdout instead of stderr. assert actual == expected, process.stdout.decode("utf-8")