Skip to content

Commit 0489160

Browse files
committed
Add test to verify generated pyproject.toml passes basic poetry inspection
1 parent 0293297 commit 0489160

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

project-template/cookiecutter.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"pypi_package_name": "exasol-{{cookiecutter.repo_name}}",
66
"import_package": "exasol.{{cookiecutter.package_name}}",
77
"description": "",
8-
"author_full_name": "",
9-
"author_email": "",
8+
"author_full_name": "{{cookiecutter.author_full_name}}",
9+
"author_email": "{{cookiecutter.author_email}}",
1010
"project_short_tag": "",
1111
"python_version_min": "3.9",
1212
"license_year": "{% now 'utc', '%Y' %}",
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import subprocess
2+
3+
import pytest
4+
5+
from noxconfig import Config
6+
7+
8+
@pytest.fixture(scope="session")
9+
def cwd(tmp_path_factory):
10+
return tmp_path_factory.mktemp("project_template_test")
11+
12+
13+
@pytest.fixture(scope="session")
14+
def new_project(cwd):
15+
project_name = "project"
16+
repo_name = "repo"
17+
package_name = "package"
18+
19+
subprocess.run(["pip", "install", "cookiecutter"], capture_output=True, check=True)
20+
subprocess.run(
21+
["cookiecutter", Config.root / "project-template", "-o", cwd, "--no-input",
22+
f"project_name={project_name}", f"repo_name={repo_name}",
23+
f"package_name={package_name}", "author_full_name=tester",
24+
25+
], capture_output=True, check=True)
26+
27+
return cwd / repo_name
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import subprocess
2+
3+
4+
def test_poetry_check_passes(new_project):
5+
"""
6+
Failure indicates that the `pyproject.toml` is not compatible with the poetry
7+
version. This checks only known poetry attributes, so there could be keys, like
8+
`project-abc = 127` that are present but since they do not have a meaning
9+
for poetry, they are ignored.
10+
"""
11+
output = subprocess.run(["poetry", "check"], cwd=new_project,
12+
capture_output=True, text=True)
13+
14+
assert output.stderr == ""
15+
assert output.stdout == "All set!\n"

0 commit comments

Comments
 (0)