Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 894502 - dev-vcs/pre-commit-3.0.4 fails tests if previously installed: AssertionError: assert Executable git not found == pre-commit not found Did you forget to activate your virtualenv?
Summary: dev-vcs/pre-commit-3.0.4 fails tests if previously installed: AssertionError:...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Marek Szuba
Depends on:
Reported: 2023-02-15 07:44 UTC by Agostino Sarubbo
Modified: 2023-11-09 00:03 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---

build.log (build.log,129.46 KB, text/plain)
2023-02-15 07:44 UTC, Agostino Sarubbo
1-test.log (1-test.log,44 bytes, text/plain)
2023-02-15 07:44 UTC, Agostino Sarubbo

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2023-02-15 07:44:31 UTC

Issue: dev-vcs/pre-commit-3.0.4 fails tests (HARDENED-SYSTEM).
Discovered on: amd64 (internal ref: hardened_tinderbox)

(HARDENED-SYSTEM) in the summary means that the bug was found on a machine that runs an hardened profile with -D_FORTIFY_SOURCE=3 and -D_GLIBCXX_ASSERTIONS ( but this bug MAY or MAY NOT BE related to the changes related to hardened.
Comment 1 Agostino Sarubbo gentoo-dev 2023-02-15 07:44:33 UTC
Created attachment 851174 [details]

build log and emerge --info
Comment 2 Agostino Sarubbo gentoo-dev 2023-02-15 07:44:34 UTC
Created attachment 851176 [details]

Comment 3 Agostino Sarubbo gentoo-dev 2023-02-15 07:44:34 UTC
Error(s) that match a know pattern in addition to what has been reported in the summary:

E           AssertionError: assert 'Executable `git` not found' == '`pre-commit` not found.  Did you forget to activate your virtualenv?
FAILED tests/commands/
FAILED tests/commands/ - a...
Comment 4 Marek Szuba archtester gentoo-dev 2023-10-25 22:24:02 UTC
Is this still a problem with 3.3.3, and if so could you confirm:
 - that the executable 'git' is actually present on the file system, and
 - if it is, that the directory containing it is in PATH?
Comment 5 Alfred Wingate 2023-11-05 18:36:06 UTC
This is a problem in 3.5.0. 

It appears to be case of removing /usr/bin instead of the venv part. This would be triggered if pre-commit was installed already.

Even if "fixed" it would cause the test to fail if pre-commit is already installed as its supposed to tests that pre-commit isn't path.
Comment 6 Larry the Git Cow gentoo-dev 2023-11-06 15:00:55 UTC
The bug has been closed via the following commit(s):

commit 2d2264f3830c1c14acd266a00577be7a86020723
Author:     Marek Szuba <>
AuthorDate: 2023-11-06 11:36:41 +0000
Commit:     Marek Szuba <>
CommitDate: 2023-11-06 15:00:45 +0000

    dev-vcs/pre-commit: deselect tests that fail if pre-commit is installed
    On the one hand quite a few bits of pre-commit rely on the executable
    "git" being present in PATH, on the other the tests delete the directory
    containing "pre-commit" from PATH prior to executing. If both reside in
    /usr/bin, hilarity ensues.
    Just deselect these tests, they aren't directly relevant to packaged
    pre-commit anyway.
    Thanks-to: Alfred Wingate <>
    Signed-off-by: Marek Szuba <>

 dev-vcs/pre-commit/pre-commit-3.3.3.ebuild | 13 ++++++++-----
 dev-vcs/pre-commit/pre-commit-3.5.0.ebuild | 13 ++++++++-----
 2 files changed, 16 insertions(+), 10 deletions(-)
Comment 7 Marek Szuba archtester gentoo-dev 2023-11-06 15:09:20 UTC
Thank you very much for having figured this out, I must say this issue had me rather stumped - mostly because I do all my package development on a clean system! I have just pulled the relevant bits out of your PR, the py3.12 stuff has been left alone because it both is beyond the scope of this issue and involves another maintainer.

Could you possibly report this problem upstream as well, so that they could try to actually fix it?
Comment 8 Alfred Wingate 2023-11-09 00:03:50 UTC
I don't think reporting it is going to be useful, upstream has gone through it before and the advice was to skip it as the test isn't useful from the context of a system wide install.

The big problem is that it failing is really caused by how gentoo installs it (and the fact it can be tested after its already installed) so upstream real has no incentive to completely rethink their tests to accommodate this edge case.

Fedora went through this at one point as well