Skip to content

Commit 97e4458

Browse files
authored
Check that all source files are well-formatted on hydration. (#537)
1 parent a405004 commit 97e4458

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

python-project-template/tests/{{package_name}}/test_packaging.py.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ import {{package_name}}
33

44
def test_version():
55
"""Check to see that we can get the package version"""
6-
assert {{package_name}}.__version__ is not None
6+
assert {{package_name}}.__version__ is not None

tests/test_package_creation.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,12 @@ def create_project_with_basic_checks(copie, extra_answers, package_name="example
5454
print("Required file not generated:", file)
5555
assert all_found
5656

57-
# black_runs_successfully
57+
# black_runs_successfully for src and tests
5858
black_results = subprocess.run(
59-
["python", "-m", "black", "--check", (result.project_dir / "src")],
59+
["python", "-m", "black", "--check", "--verbose", result.project_dir],
6060
cwd=result.project_dir,
6161
check=False,
6262
)
63-
6463
assert black_results.returncode == 0
6564

6665
return result
@@ -69,7 +68,7 @@ def create_project_with_basic_checks(copie, extra_answers, package_name="example
6968
def pylint_runs_successfully(result):
7069
"""Test to ensure that the pylint linter runs successfully on the project"""
7170
# run pylint to ensure that the hydrated files are linted correctly
72-
pylint_results = subprocess.run(
71+
pylint_src_results = subprocess.run(
7372
[
7473
"python",
7574
"-m",
@@ -82,7 +81,20 @@ def pylint_runs_successfully(result):
8281
check=False,
8382
)
8483

85-
return pylint_results.returncode == 0
84+
pylint_test_results = subprocess.run(
85+
[
86+
"python",
87+
"-m",
88+
"pylint",
89+
"--recursive=y",
90+
"--rcfile=./tests/.pylintrc",
91+
(result.project_dir / "tests"),
92+
],
93+
cwd=result.project_dir,
94+
check=False,
95+
)
96+
97+
return pylint_src_results.returncode == 0 and pylint_test_results.returncode == 0
8698

8799

88100
def docs_build_successfully(result):

0 commit comments

Comments
 (0)