-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
pythonPackages.pynacl: ignore timeout in tests #34858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I think in this case it's better to create a patch rather than using sed. It's quite confusing like that. |
And why are you using |
Earlier you opened #34847 which we merged. It was still not properly fixed? |
The timeout was not fixed there, the deadline was but due to my inexperience (my first "big" PR to nixpkgs) I thought preCheck was the right stage to go with, @dotlambda was right of course: I want prePatch. Thanks for your patience and help, guys! Creating a patch file now 😊 |
After this has been resolved, I'll try building the package on a veeeeery slow ARMv7 machine. So please don't merge before my confirmation. |
don't modify test_aead.py yet add pynacl-no-timeout-and-deadline.patch
max_value=16 * 1024 * 1024) | ||
) | ||
-@settings(deadline=1500, max_examples=20) | ||
+@settings(timeout=unlimited, deadline=None, max_examples=20) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When there was no timeout before, why do you have to set it to unlimited?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's set to 60s by default: http://hypothesis.readthedocs.io/en/latest/settings.html?highlight=timeout#hypothesis.settings.timeout
I put a time.sleep into the tests and not specifying the timeout actually lets it fail if it takes longer than 60s. Of course you need a really really slow system for this to take longer than a minute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that's the case, what do you think about disabling the timeout for the hypothesis package completely, @FRidh? Of course I don't know if that's possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides that the timeout feature is also already deprecated and will be removed at some point in the future: http://hypothesis.readthedocs.io/en/latest/changes.html#id118
Until then using unlimited is recommended, though.
Actually, I think this derivation needs to be changed a little more. |
Thanks for pointing that out, @dotlambda |
I can confirm that tests do not fail anymore on my Banana Pi with this PR applied. |
I propose the following changes: diff --git a/pkgs/development/python-modules/pynacl/default.nix b/pkgs/development/python-modules/pynacl/default.nix
index 981427e46f3..865b8c02fef 100644
--- a/pkgs/development/python-modules/pynacl/default.nix
+++ b/pkgs/development/python-modules/pynacl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildPythonPackage, fetchFromGitHub, pytest, coverage, libsodium, cffi, six, hypothesis}:
+{ lib, buildPythonPackage, fetchFromGitHub, isPyPy, pytest, libsodium, cffi, six, hypothesis }:
buildPythonPackage rec {
pname = "pynacl";
@@ -11,17 +11,21 @@ buildPythonPackage rec {
sha256 = "0z9i1z4hjzmp23igyhvg131gikbrr947506lwfb3fayf0agwfv8f";
};
- #set timeout to unlimited, remove deadline from tests, see https://github.com/pyca/pynacl/issues/370
+ # set timeout to unlimited, remove deadline from tests, see https://github.com/pyca/pynacl/issues/370
patches = [ ./pynacl-no-timeout-and-deadline.patch ];
- checkInputs = [ pytest coverage hypothesis ];
- propagatedBuildInputs = [ libsodium cffi six ];
+ checkInputs = [ pytest hypothesis ];
+ propagatedBuildInputs = [ libsodium six ] ++ lib.optional (!isPyPy) cffi;
+
+ preBuild = ''
+ export SODIUM_INSTALL=system
+ '';
checkPhase = ''
- coverage run --source nacl --branch -m pytest
+ py.test
'';
- meta = with stdenv.lib; {
+ meta = with lib; {
maintainers = with maintainers; [ va1entin ];
description = "Python binding to the Networking and Cryptography (NaCl) library";
homepage = https://github.com/pyca/pynacl/; I can't actually test with PyPy because hypothesis depends on configparser, which isn't supported for PyPy. That must still be fixed somehow :) Either you incorporate the changes into your PR @va1entin or @FRidh merges this one and I open a new one. |
Thanks for the proposal @dotlambda 👍 |
@GrahamcOfBorg build python3Packages.pynacl python2Packages.pynacl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FRidh I'll create a PR for using system libsodium as soons as this is merged.
@FRidh Is there any reason why this isn't merged yet? |
Motivation for this change
In addition to a deadline there is also a timeout in pynacl tests, which might result in failing builds on slow machines. The new prePatch phase turns both off.
Things done
Set timeout to unlimited and deadline to None in hypothesis tests for pynacl
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)