From b2f1df7cff8da932c7f31ccbad0d64578ff4e614 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Wed, 31 Jul 2024 12:00:30 +0200 Subject: [PATCH] nix: fix tests in setuptools derivation --- CONTRIBUTING.md | 2 +- flake.nix | 19 ++++++++++--------- setup.py | 1 - 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0dcf5e84d..7b58e36af 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,7 +42,7 @@ To ensure timely and painless reviews please keep the following in mind. For new features also update the user manual in `docs/source/usage` accordingly. * Unit tests: Make sure your changes don't break any existing tests (to check - locally use `./setup.py test`). If you are fixing a bug or adding a new + locally use `python3 -m unittest`). If you are fixing a bug or adding a new features please provide new tests if possible. * Keep commits simple. Large individual patches are incredibly painful to review properly. diff --git a/flake.nix b/flake.nix index b2e27889d..489edcc7c 100644 --- a/flake.nix +++ b/flake.nix @@ -21,6 +21,14 @@ notmuch2 = pkgs.python3.pkgs.notmuch2; }); }; + checkPhase = '' + # In the nix sandbox stdin is not a terminal but /dev/null so we + # change the shell command only in this specific test. + sed -i '/test_no_spawn_no_stdin_attached/,/^$/s/test -t 0/sh -c "[ $(wc -l) -eq 0 ]"/' tests/commands/test_global.py + + python3 -m unittest -v + ''; + nativeCheckInputs = with pkgs; [ gnupg notmuch procps ]; in { packages = { @@ -37,6 +45,7 @@ urwid urwidtrees ]; + inherit checkPhase nativeCheckInputs; }; alot-poetry = mkPoetryApplication (defaultArgs // { nativeBuildInputs = [ @@ -47,15 +56,7 @@ pkgs.gpgme.dev pkgs.python3.pkgs.cffi ]; - - nativeCheckInputs = with pkgs; [ gnupg notmuch procps ]; - checkPhase = '' - # In the nix sandbox stdin is not a terminal but /dev/null so we - # change the shell command only in this specific test. - sed -i '/test_no_spawn_no_stdin_attached/,/^$/s/test -t 0/sh -c "[ $(wc -l) -eq 0 ]"/' tests/commands/test_global.py - - python3 -m unittest -v - ''; + inherit checkPhase nativeCheckInputs; }); docs = pkgs.runCommand "alot-docs" { src = self; diff --git a/setup.py b/setup.py index 2f86298d9..cb0b92235 100755 --- a/setup.py +++ b/setup.py @@ -17,5 +17,4 @@ 'defaults/theme.spec', ] }, - test_suite="tests", )