You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems to be a known issue, and one way to mitigate this is to generate lower security password hashes.
By using method='pbkdf2:sha1:1000' in generate_password_hash tests run in 24s (instead of 59s) or 8s with xdist (instead of 17s).
I suggest to use a faster and less secure hash algorithm to run unit tests, but still use the default algorithm in other environment. I think a simple solution would be to add two configuration parameters PASSWORD_HASH_METHOD and PASSWORD_HASH_SALT that would be passed as arguments in generate_password_hash. By default those vars would be unset, except in the unit test environment where they would have convenient values.
I would volunteer to provide a PR for this.
What do you think?
The text was updated successfully, but these errors were encountered:
Testing the whole test suite takes 59s for the 118 tests on my computer (which is very capable).
With pytest-xdist and 8 CPUs this goes down to 17s (
pytest -n auto
)pytest --durations 10
gives us those stats:Looking a bit more closely with pytest-profiling and snakeviz, I can see that the longest function call is werkzeug.security.check_password_hash from the
need_auth
decorator:ihatemoney/ihatemoney/api/common.py
Line 28 in 0187932
It seems to be a known issue, and one way to mitigate this is to generate lower security password hashes.
By using
method='pbkdf2:sha1:1000'
ingenerate_password_hash
tests run in 24s (instead of 59s) or 8s with xdist (instead of 17s).I suggest to use a faster and less secure hash algorithm to run unit tests, but still use the default algorithm in other environment. I think a simple solution would be to add two configuration parameters
PASSWORD_HASH_METHOD
andPASSWORD_HASH_SALT
that would be passed as arguments ingenerate_password_hash
. By default those vars would be unset, except in the unit test environment where they would have convenient values.I would volunteer to provide a PR for this.
What do you think?
The text was updated successfully, but these errors were encountered: