Skip to content

Commit

Permalink
nix: fix tests in setuptools derivation
Browse files Browse the repository at this point in the history
  • Loading branch information
lucc committed Jul 31, 2024
1 parent 04a5568 commit b2f1df7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 10 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -37,6 +45,7 @@
urwid
urwidtrees
];
inherit checkPhase nativeCheckInputs;
};
alot-poetry = mkPoetryApplication (defaultArgs // {
nativeBuildInputs = [
Expand All @@ -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;
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@
'defaults/theme.spec',
]
},
test_suite="tests",
)

0 comments on commit b2f1df7

Please sign in to comment.