pre-commit: fix import bug for built-in hooks
And add regression test. Closes #270805. Co-Authored-By: Matt Rixman <MatrixManAtYrService@users.noreply.github.com>
This commit is contained in:
parent
ae7c1f0fb4
commit
291e11d98f
@ -107,12 +107,6 @@ buildPythonApplication rec {
|
|||||||
deactivate
|
deactivate
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Propagating dependencies leaks them through $PYTHONPATH which causes issues
|
|
||||||
# when used in nix-shell.
|
|
||||||
postFixup = ''
|
|
||||||
rm $out/nix-support/propagated-build-inputs
|
|
||||||
'';
|
|
||||||
|
|
||||||
disabledTests = [
|
disabledTests = [
|
||||||
# ERROR: The install method you used for conda--probably either `pip install conda`
|
# ERROR: The install method you used for conda--probably either `pip install conda`
|
||||||
# or `easy_install conda`--is not compatible with using conda as an application.
|
# or `easy_install conda`--is not compatible with using conda as an application.
|
||||||
@ -182,8 +176,8 @@ buildPythonApplication rec {
|
|||||||
"pre_commit"
|
"pre_commit"
|
||||||
];
|
];
|
||||||
|
|
||||||
passthru.tests.version = testers.testVersion {
|
passthru.tests = callPackage ./tests.nix {
|
||||||
package = pre-commit;
|
inherit git pre-commit;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
45
pkgs/by-name/pr/pre-commit/tests.nix
Normal file
45
pkgs/by-name/pr/pre-commit/tests.nix
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
git,
|
||||||
|
pre-commit,
|
||||||
|
runCommand,
|
||||||
|
testers,
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
check-meta-hooks =
|
||||||
|
runCommand "check-meta-hooks"
|
||||||
|
{
|
||||||
|
nativeBuildInputs = [
|
||||||
|
git
|
||||||
|
pre-commit
|
||||||
|
];
|
||||||
|
}
|
||||||
|
''
|
||||||
|
cd "$(mktemp --directory)"
|
||||||
|
export HOME="$PWD"
|
||||||
|
cat << 'EOF' > .pre-commit-config.yaml
|
||||||
|
repos:
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: echo
|
||||||
|
name: echo
|
||||||
|
entry: echo
|
||||||
|
files: \.yaml$
|
||||||
|
language: system
|
||||||
|
- repo: meta
|
||||||
|
hooks:
|
||||||
|
- id: check-hooks-apply
|
||||||
|
- id: check-useless-excludes
|
||||||
|
- id: identity
|
||||||
|
EOF
|
||||||
|
git config --global user.email "you@example.com"
|
||||||
|
git config --global user.name "Your Name"
|
||||||
|
git init --initial-branch=main
|
||||||
|
git add .
|
||||||
|
pre-commit run --all-files
|
||||||
|
touch $out
|
||||||
|
'';
|
||||||
|
|
||||||
|
version = testers.testVersion {
|
||||||
|
package = pre-commit;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user