From 3ebc3e0d8acd6c4d50cf2e3f1eb9c10227a83c37 Mon Sep 17 00:00:00 2001 From: Melissa DeLucchi Date: Tue, 30 Sep 2025 11:31:03 -0400 Subject: [PATCH] Check that all source files are well-formatted on hydration. --- .../{{package_name}}/test_packaging.py.jinja | 2 +- tests/test_package_creation.py | 22 ++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/python-project-template/tests/{{package_name}}/test_packaging.py.jinja b/python-project-template/tests/{{package_name}}/test_packaging.py.jinja index bf2dc02..19b839c 100644 --- a/python-project-template/tests/{{package_name}}/test_packaging.py.jinja +++ b/python-project-template/tests/{{package_name}}/test_packaging.py.jinja @@ -3,4 +3,4 @@ import {{package_name}} def test_version(): """Check to see that we can get the package version""" - assert {{package_name}}.__version__ is not None \ No newline at end of file + assert {{package_name}}.__version__ is not None diff --git a/tests/test_package_creation.py b/tests/test_package_creation.py index d7d0a76..e04c134 100644 --- a/tests/test_package_creation.py +++ b/tests/test_package_creation.py @@ -54,13 +54,12 @@ def create_project_with_basic_checks(copie, extra_answers, package_name="example print("Required file not generated:", file) assert all_found - # black_runs_successfully + # black_runs_successfully for src and tests black_results = subprocess.run( - ["python", "-m", "black", "--check", (result.project_dir / "src")], + ["python", "-m", "black", "--check", "--verbose", result.project_dir], cwd=result.project_dir, check=False, ) - assert black_results.returncode == 0 return result @@ -69,7 +68,7 @@ def create_project_with_basic_checks(copie, extra_answers, package_name="example def pylint_runs_successfully(result): """Test to ensure that the pylint linter runs successfully on the project""" # run pylint to ensure that the hydrated files are linted correctly - pylint_results = subprocess.run( + pylint_src_results = subprocess.run( [ "python", "-m", @@ -82,7 +81,20 @@ def pylint_runs_successfully(result): check=False, ) - return pylint_results.returncode == 0 + pylint_test_results = subprocess.run( + [ + "python", + "-m", + "pylint", + "--recursive=y", + "--rcfile=./tests/.pylintrc", + (result.project_dir / "tests"), + ], + cwd=result.project_dir, + check=False, + ) + + return pylint_src_results.returncode == 0 and pylint_test_results.returncode == 0 def docs_build_successfully(result):