Merge pull request 'lib/test/container-test-driver: Fix extraPythonPackages support' (#5491) from ke-test-extra-packages into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/5491
This commit is contained in:
DavHau
2025-10-14 13:33:08 +00:00
4 changed files with 32 additions and 9 deletions

View File

@@ -88,6 +88,7 @@ in
nixos-test-container = self.clanLib.test.containerTest ./container nixosTestArgs;
nixos-test-user-firewall-iptables = self.clanLib.test.containerTest ./user-firewall/iptables.nix nixosTestArgs;
nixos-test-user-firewall-nftables = self.clanLib.test.containerTest ./user-firewall/nftables.nix nixosTestArgs;
nixos-test-extra-python-packages = self.clanLib.test.containerTest ./test-extra-python-packages nixosTestArgs;
service-dummy-test = import ./service-dummy-test nixosTestArgs;
wireguard = import ./wireguard nixosTestArgs;

View File

@@ -0,0 +1,26 @@
(
{ ... }:
{
name = "test-extra-python-packages";
extraPythonPackages = ps: [ ps.numpy ];
nodes.machine =
{ ... }:
{
networking.hostName = "machine";
};
testScript = ''
import numpy as np
start_all()
machine.wait_for_unit("multi-user.target")
# Test availability of numpy
arr = np.array([1, 2, 3])
print(f"Numpy array: {arr}")
assert len(arr) == 3
'';
}
)

View File

@@ -5,7 +5,7 @@
...
}:
let
testDriver = hostPkgs.python3.pkgs.callPackage ./package.nix {
testDriver = hostPkgs.callPackage ./package.nix {
inherit (config) extraPythonPackages;
inherit (hostPkgs.pkgs) util-linux systemd nix;
};

View File

@@ -2,28 +2,24 @@
extraPythonPackages ? (_ps: [ ]),
python3Packages,
python3,
buildPythonApplication,
setuptools,
util-linux,
systemd,
nix,
colorama,
junit-xml,
mkShell,
}:
let
package = buildPythonApplication {
package = python3Packages.buildPythonApplication {
pname = "test-driver";
version = "0.0.1";
propagatedBuildInputs = [
util-linux
systemd
colorama
junit-xml
python3Packages.colorama
python3Packages.junit-xml
nix
]
++ extraPythonPackages python3Packages;
nativeBuildInputs = [ setuptools ];
nativeBuildInputs = [ python3Packages.setuptools ];
format = "pyproject";
src = ./.;
passthru.devShell = mkShell {