python3Packages.pytestCheckHook: add tests

This commit is contained in:
Yueh-Shun Li
2025-03-07 07:14:56 +08:00
parent 2e512e7cf7
commit 9346e6aa5f
@@ -146,13 +146,60 @@ in
};
pytestCheckHook = callPackage (
{ makePythonHook, pytest }:
{
makePythonHook,
pytest,
# For package tests
testers,
objprint,
}:
makePythonHook {
name = "pytest-check-hook";
propagatedBuildInputs = [ pytest ];
substitutions = {
inherit pythonCheckInterpreter;
};
passthru = {
tests = {
basic = objprint.overridePythonAttrs (previousPythonAttrs: {
pname = "test-pytestCheckHook-basic-${previousPythonAttrs.pname}";
});
disabledTests = objprint.overridePythonAttrs (previousPythonAttrs: {
pname = "test-pytestCheckHook-disabledTests-${previousPythonAttrs.pname}";
disabledTests = [
"test_print"
] ++ previousPythonAttrs.disabledTests or [ ];
});
disabledTestPaths = objprint.overridePythonAttrs (previousPythonAttrs: {
pname = "test-pytestCheckHook-disabledTestPaths-${previousPythonAttrs.pname}";
disabledTestPaths = [
"tests/test_basic.py"
] ++ previousPythonAttrs.disabledTestPaths or [ ];
});
disabledTestPaths-nonexistent = testers.testBuildFailure (
objprint.overridePythonAttrs (previousPythonAttrs: {
pname = "test-pytestCheckHook-disabledTestPaths-nonexistent-${previousPythonAttrs.pname}";
disabledTestPaths = [
"tests/test_foo.py"
] ++ previousPythonAttrs.disabledTestPaths or [ ];
})
);
disabledTestPaths-glob = objprint.overridePythonAttrs (previousPythonAttrs: {
pname = "test-pytestCheckHook-disabledTestPaths-glob-${previousPythonAttrs.pname}";
disabledTestPaths = [
"tests/test_obj*.py"
] ++ previousPythonAttrs.disabledTestPaths or [ ];
});
disabledTestPaths-glob-nonexistent = testers.testBuildFailure (
objprint.overridePythonAttrs (previousPythonAttrs: {
pname = "test-pytestCheckHook-disabledTestPaths-glob-nonexistent-${previousPythonAttrs.pname}";
disabledTestPaths = [
"tests/test_foo*.py"
] ++ previousPythonAttrs.disabledTestPaths or [ ];
})
);
};
};
} ./pytest-check-hook.sh
) { };