[issue38120] DeprecationWarning in test_random due to invalid seed arguments

STINNER Victor report at bugs.python.org
Wed Sep 11 18:35:11 EDT 2019


STINNER Victor <vstinner at python.org> added the comment:

I confirm that test_random currently fails using -Werror:

$ ./python -W error -m test  -v test_random

======================================================================
ERROR: test_seed_when_randomness_source_not_found (test.test_random.MersenneTwister_TestBasicOps)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/python/master/Lib/unittest/mock.py", line 1319, in patched
    return func(*newargs, **newkeywargs)
  File "/home/vstinner/python/master/Lib/test/test_random.py", line 60, in test_seed_when_randomness_source_not_found
    self.test_seedargs()
  File "/home/vstinner/python/master/Lib/test/test_random.py", line 46, in test_seedargs
    self.gen.seed(arg)
  File "/home/vstinner/python/master/Lib/random.py", line 156, in seed
    _warn('Seeding based on hashing is deprecated\n'
DeprecationWarning: Seeding based on hashing is deprecated
since Python 3.9 and will be removed in a subsequent version. The only 
supported seed types are: None, int, float, str, bytes, and bytearray.

======================================================================
ERROR: test_seedargs (test.test_random.MersenneTwister_TestBasicOps)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/python/master/Lib/test/test_random.py", line 46, in test_seedargs
    self.gen.seed(arg)
  File "/home/vstinner/python/master/Lib/random.py", line 156, in seed
    _warn('Seeding based on hashing is deprecated\n'
DeprecationWarning: Seeding based on hashing is deprecated
since Python 3.9 and will be removed in a subsequent version. The only 
supported seed types are: None, int, float, str, bytes, and bytearray.


I also confirm that PR 15987 fix the issue.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38120>
_______________________________________


More information about the Python-bugs-list mailing list