lol

python3Packages.bork: add test using `testers.runCommand`

This will serve as a “real-world” example, running tests requiring network.

nicoo 244229a8 d0a96c6e

+33
+2
pkgs/build-support/testers/test/default.nix
··· 19 19 shellcheck = pkgs.callPackage ../shellcheck/tests.nix { }; 20 20 21 21 runCommand = lib.recurseIntoAttrs { 22 + bork = pkgs.python3Packages.bork.tests.pytest-network; 23 + 22 24 dns-resolution = testers.runCommand { 23 25 name = "runCommand-dns-resolution-test"; 24 26 nativeBuildInputs = [ pkgs.ldns ];
+3
pkgs/development/python-modules/bork/default.nix
··· 1 1 { 2 2 lib, 3 3 buildPythonPackage, 4 + callPackage, 4 5 fetchFromGitHub, 5 6 pytestCheckHook, 6 7 pythonOlder, ··· 60 61 # tries to call python -m bork 61 62 "test_repo" 62 63 ]; 64 + 65 + passthru.tests = callPackage ./tests.nix { }; 63 66 64 67 meta = with lib; { 65 68 description = "Python build and release management tool";
+28
pkgs/development/python-modules/bork/tests.nix
··· 1 + { 2 + testers, 3 + 4 + bork, 5 + cacert, 6 + git, 7 + pytest, 8 + }: 9 + { 10 + # a.k.a. `tests.testers.runCommand.bork` 11 + pytest-network = testers.runCommand { 12 + name = "bork-pytest-network"; 13 + nativeBuildInputs = [ 14 + bork 15 + cacert 16 + git 17 + pytest 18 + ]; 19 + script = '' 20 + # Copy the source tree over, and make it writeable 21 + cp -r ${bork.src} bork/ 22 + find -type d -exec chmod 0755 '{}' '+' 23 + 24 + pytest -v -m network bork/ 25 + touch $out 26 + ''; 27 + }; 28 + }