Skip to content

ci: Improve pre-commit-hook testing#421

Open
klmcadams wants to merge 9 commits into
mainfrom
feat/improve-testing
Open

ci: Improve pre-commit-hook testing#421
klmcadams wants to merge 9 commits into
mainfrom
feat/improve-testing

Conversation

@klmcadams

Copy link
Copy Markdown
Contributor

Created a workflow file for testing the pre-commit hook as if it were running on external repos. For the add-license-headers hook, it tests each of the arguments

@klmcadams klmcadams linked an issue Apr 23, 2026 that may be closed by this pull request
@github-actions github-actions Bot added maintenance Package and maintenance related enhancement New features or code improvements labels Apr 23, 2026
@klmcadams klmcadams marked this pull request as ready for review April 23, 2026 15:31
@klmcadams klmcadams requested a review from a team as a code owner April 23, 2026 15:31

@SMoraisAnsys SMoraisAnsys left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes @klmcadams, just wondering if we should think about using prek instead of pre-commit in the tests given the discussion we had in the past. Might be something to question in our meeting to know how many of us started to migrate to prek.

cp ../hooks-repo/tests/test_tech_review_files/AUTHORS .
cp ../hooks-repo/tests/test_tech_review_files/CODE_OF_CONDUCT.md .
cp ../hooks-repo/tests/test_tech_review_files/CONTRIBUTING.md .
cp "../hooks-repo/tests/test_tech_review_files/dependabot_pyproject.yml" .github/dependabot.yml || true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cp "../hooks-repo/tests/test_tech_review_files/dependabot_pyproject.yml" .github/dependabot.yml || true

Given that it is performed separately in the coming lines, it should be removed from here

exit 1
fi

integration-tech-review:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it possible to run that step as a precommit hook from the project side (I mean development) and not as a job in the CI ?

@RobPasMue RobPasMue left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea for testing... however, I am wondering... Why couldn't this be set up as integration tests inside our tests folder and using subprocess? Doesn't seem to be incompatible, right? You could leverage fixtures to make sure the wheel gets build and you use subprocess to call the tests from a dedicated virtual environment you create inside the tests folder for example...

We can discuss offline if you prefer. It might be more cumbersome to set up but at least the tests would remain within pytest and they would be easily runnable.. the main problem we have now (as CI/CD-based tests) is that they are only replicable on CI/CD.

It's fine on my side if this is the way to go but I just wanted to bring this up in case it wasn't considered... and if it was considered, I'd like to read the reasoning/rationale =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New features or code improvements maintenance Package and maintenance related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve testing for pre-commit hooks

4 participants