about summary refs log tree commit diff
path: root/tests/sandbox.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2020-08-29 00:57:47 +0200
committeraszlig <aszlig@nix.build>2020-08-29 01:08:17 +0200
commit0e72073cb6b5f2d6c3b1ec0eb87412dce809f48c (patch)
treeeb28b1d0d148821d46fa11a84dae5ccfa1d73643 /tests/sandbox.nix
parentecbf74ae6117197f3b7560753f7db73e363f5991 (diff)
tests: Switch all tests to Python test driver
Since the removal[1] of the Perl test driver, our tests will no longer
run or even evaluate.

Fortunately, the test API is more or less the same, so the transition to
Python was not very involved.

However, I did add a "# fmt: off" on top of every testScript, since
formatting with black not only has issues with parameterised
antiquotations but is also plain ugly to mix 2 spaces of indentation
with 4 spaces of indentation.

Additionally, I'd like to have a maximum line length of 79 characters in
my Nix expressions while black on the other side even *insists* of using
longer lines.

[1]: https://github.com/NixOS/nixpkgs/commit/0620184f3f94f1bf8de014ab168

Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'tests/sandbox.nix')
-rw-r--r--tests/sandbox.nix25
1 files changed, 13 insertions, 12 deletions
diff --git a/tests/sandbox.nix b/tests/sandbox.nix
index 66187b23..63d8af6e 100644
--- a/tests/sandbox.nix
+++ b/tests/sandbox.nix
@@ -120,21 +120,22 @@
   };
 
   testScript = ''
-    $machine->waitForUnit('multi-user.target');
-    $machine->succeed('su - -c "xvfb-run gtk-launch test" foo >&2');
-    $machine->waitForFile('/home/foo/.cache/xdg/done');
+    # fmt: off
+    machine.wait_for_unit('multi-user.target')
+    machine.succeed('su - -c "xvfb-run gtk-launch test" foo >&2')
+    machine.wait_for_file('/home/foo/.cache/xdg/done')
 
-    $machine->succeed('test -d /home/foo/existing');
-    $machine->succeed('grep -qF foo /home/foo/existing/bar');
-    $machine->fail('test -d /home/foo/nonexisting');
+    machine.succeed('test -d /home/foo/existing')
+    machine.succeed('grep -qF foo /home/foo/existing/bar')
+    machine.fail('test -d /home/foo/nonexisting')
 
-    $machine->succeed('grep -qF XDG1 /home/foo/.local/share/xdg/1');
-    $machine->succeed('grep -qF XDG2 /home/foo/.config/xdg/2');
-    $machine->succeed('grep -qF XDG3 /home/foo/.cache/xdg/3');
+    machine.succeed('grep -qF XDG1 /home/foo/.local/share/xdg/1')
+    machine.succeed('grep -qF XDG2 /home/foo/.config/xdg/2')
+    machine.succeed('grep -qF XDG3 /home/foo/.cache/xdg/3')
 
-    $machine->succeed('test "$(< /home/foo/.cache/xdg/procpids)" = /proc/1');
-    $machine->succeed('test "$(< /home/foo/.cache/xdg/ownpid)" = 1');
+    machine.succeed('test "$(< /home/foo/.cache/xdg/procpids)" = /proc/1')
+    machine.succeed('test "$(< /home/foo/.cache/xdg/ownpid)" = 1')
 
-    $machine->succeed('test "$(su -c test-sandbox2 foo)" = "/bin/sh works"');
+    machine.succeed('test "$(su -c test-sandbox2 foo)" = "/bin/sh works"')
   '';
 }