Skip to content

Commit eb651ba

Browse files
committed
Clarify pylint behavior, and make it pass again.
1 parent ca06fda commit eb651ba

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

python-project-template/pyproject.toml.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license = "MIT"
99
license = "GPL-3.0-only"
1010
{%- endif %}
1111
{%- if project_license != 'none' %}
12-
license_file = ["LICENSE"]
12+
license-files = ["LICENSE"]
1313
{%- endif %}
1414
readme = "README.md"
1515
authors = [

tests/test_package_creation.py

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ def create_project_with_basic_checks(copie, extra_answers, package_name="example
1818
result.exit_code == 0 and result.exception is None and result.project_dir.is_dir()
1919
), "Did not successfully create project"
2020

21+
# install the `example_package` into the existing python environment.
22+
build_results = subprocess.run(
23+
["python", "-m", "pip", "install", "--no-deps", "."], cwd=result.project_dir, check=False
24+
)
25+
assert build_results.returncode == 0
26+
2127
# pyproject_toml_is_valid
2228
precommit_results = subprocess.run(
2329
["pre-commit", "run", "validate-pyproject"], cwd=result.project_dir, check=False
@@ -48,19 +54,16 @@ def create_project_with_basic_checks(copie, extra_answers, package_name="example
4854
print("Required file not generated:", file)
4955
assert all_found
5056

51-
return result
52-
53-
54-
def black_runs_successfully(result):
55-
"""Test to ensure that the black linter runs successfully on the project"""
56-
# run black with `--check` to look for lint errors, but don't fix them.
57+
# black_runs_successfully
5758
black_results = subprocess.run(
5859
["python", "-m", "black", "--check", (result.project_dir / "src")],
5960
cwd=result.project_dir,
6061
check=False,
6162
)
6263

63-
return black_results.returncode == 0
64+
assert black_results.returncode == 0
65+
66+
return result
6467

6568

6669
def pylint_runs_successfully(result):
@@ -123,6 +126,7 @@ def test_all_defaults(copie):
123126
# run copier to hydrate a temporary project
124127
result = create_project_with_basic_checks(copie, {})
125128

129+
# uses ruff instead of (black/isort/pylint)
126130
assert not pylint_runs_successfully(result)
127131

128132
# check to see if the README file was hydrated with copier answers.
@@ -161,8 +165,6 @@ def test_use_black_and_no_example_modules(copie):
161165
break
162166
assert found_line
163167

164-
assert black_runs_successfully(result)
165-
166168

167169
@pytest.mark.parametrize(
168170
"enforce_style",
@@ -187,9 +189,6 @@ def test_code_style_combinations(copie, enforce_style):
187189
}
188190
result = create_project_with_basic_checks(copie, extra_answers)
189191

190-
# black would still run successfully.
191-
assert black_runs_successfully(result)
192-
193192

194193
@pytest.mark.parametrize(
195194
"notification",
@@ -211,7 +210,6 @@ def test_smoke_test_notification(copie, notification):
211210

212211
# run copier to hydrate a temporary project
213212
result = create_project_with_basic_checks(copie, extra_answers)
214-
assert black_runs_successfully(result)
215213

216214

217215
@pytest.mark.parametrize(
@@ -233,8 +231,6 @@ def test_license(copie, license):
233231
# run copier to hydrate a temporary project
234232
result = create_project_with_basic_checks(copie, extra_answers)
235233

236-
assert black_runs_successfully(result)
237-
238234

239235
@pytest.mark.parametrize(
240236
"doc_answers",
@@ -255,7 +251,6 @@ def test_doc_combinations(copie, doc_answers):
255251
# run copier to hydrate a temporary project
256252
result = create_project_with_basic_checks(copie, doc_answers)
257253

258-
assert black_runs_successfully(result)
259254
assert docs_build_successfully(result)
260255
assert (result.project_dir / "docs").is_dir()
261256

@@ -279,7 +274,6 @@ def test_doc_combinations_no_docs(copie, doc_answers):
279274
# run copier to hydrate a temporary project
280275
result = create_project_with_basic_checks(copie, doc_answers)
281276

282-
assert black_runs_successfully(result)
283277
assert not (result.project_dir / "docs").is_dir()
284278

285279

@@ -296,8 +290,6 @@ def test_test_lowest_version(copie, test_lowest_version):
296290
# run copier to hydrate a temporary project
297291
result = create_project_with_basic_checks(copie, extra_answers)
298292

299-
assert black_runs_successfully(result)
300-
301293

302294
def test_github_workflows_schema(copie):
303295
"""Confirm the current GitHub workflows have valid schemas."""

0 commit comments

Comments
 (0)