about summary refs log tree commit diff
path: root/pkgs/development/python-modules/soundcard/test.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/soundcard/test.nix')
-rw-r--r--pkgs/development/python-modules/soundcard/test.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/soundcard/test.nix b/pkgs/development/python-modules/soundcard/test.nix
new file mode 100644
index 000000000000..720e7336cd6a
--- /dev/null
+++ b/pkgs/development/python-modules/soundcard/test.nix
@@ -0,0 +1,47 @@
+{
+  name = "Python Soundcard Library Test";
+
+  nodes.machine =
+    { pkgs, ... }:
+    {
+      environment.systemPackages = [ (pkgs.python3.withPackages (ps: [ ps.soundcard ])) ];
+
+      hardware.pulseaudio.enable = true;
+      hardware.pulseaudio.systemWide = true;
+
+      virtualisation.qemu.options = [
+        "-device virtio-sound-pci,audiodev=my_audiodev"
+        "-audiodev wav,id=my_audiodev"
+      ];
+    };
+
+  interactive.nodes.machine =
+    { ... }:
+    {
+      services.openssh.enable = true;
+      services.openssh.settings.PermitRootLogin = "yes";
+      users.extraUsers.root.initialPassword = "";
+      users.extraUsers.root.hashedPassword = null;
+      users.extraUsers.root.hashedPasswordFile = null;
+      users.extraUsers.root.initialHashedPassword = null;
+      virtualisation.forwardPorts = [
+        {
+          from = "host";
+          host.port = 2222;
+          guest.port = 22;
+        }
+      ];
+    };
+
+  testScript =
+    let
+      script = builtins.toFile "import.py" ''
+        import soundcard
+      '';
+    in
+    ''
+      start_all()
+      machine.wait_for_unit("multi-user.target")
+      machine.succeed("python ${script}")
+    '';
+}