mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
python3Packages.bork: add test using testers.runCommand
This will serve as a “real-world” example, running tests requiring network.
This commit is contained in:
parent
d0a96c6eda
commit
244229a8b6
@ -19,6 +19,8 @@ lib.recurseIntoAttrs {
|
||||
shellcheck = pkgs.callPackage ../shellcheck/tests.nix { };
|
||||
|
||||
runCommand = lib.recurseIntoAttrs {
|
||||
bork = pkgs.python3Packages.bork.tests.pytest-network;
|
||||
|
||||
dns-resolution = testers.runCommand {
|
||||
name = "runCommand-dns-resolution-test";
|
||||
nativeBuildInputs = [ pkgs.ldns ];
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
callPackage,
|
||||
fetchFromGitHub,
|
||||
pytestCheckHook,
|
||||
pythonOlder,
|
||||
@ -61,6 +62,8 @@ buildPythonPackage rec {
|
||||
"test_repo"
|
||||
];
|
||||
|
||||
passthru.tests = callPackage ./tests.nix { };
|
||||
|
||||
meta = with lib; {
|
||||
description = "Python build and release management tool";
|
||||
mainProgram = "bork";
|
||||
|
28
pkgs/development/python-modules/bork/tests.nix
Normal file
28
pkgs/development/python-modules/bork/tests.nix
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
testers,
|
||||
|
||||
bork,
|
||||
cacert,
|
||||
git,
|
||||
pytest,
|
||||
}:
|
||||
{
|
||||
# a.k.a. `tests.testers.runCommand.bork`
|
||||
pytest-network = testers.runCommand {
|
||||
name = "bork-pytest-network";
|
||||
nativeBuildInputs = [
|
||||
bork
|
||||
cacert
|
||||
git
|
||||
pytest
|
||||
];
|
||||
script = ''
|
||||
# Copy the source tree over, and make it writeable
|
||||
cp -r ${bork.src} bork/
|
||||
find -type d -exec chmod 0755 '{}' '+'
|
||||
|
||||
pytest -v -m network bork/
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user