def decorator(test_method): seed = hypothesis_reproduction_seed() if seed is not None: # This implements the semantics of TFP_HYPOTHESIS_REPRODUCE via # the `hp.reproduce_failure` decorator. test_method = hp.reproduce_failure('3.56.5', seed)(test_method) return hp.settings(**kwds)(test_method)
def decorator(test_method): repro_seed = hypothesis_reproduction_seed() if repro_seed is not None: # This implements the semantics of TFP_HYPOTHESIS_REPRODUCE via # the `hp.reproduce_failure` decorator. test_method = hp.reproduce_failure('3.56.5', repro_seed)(test_method) elif randomize_hypothesis(): # Hypothesis defaults to seeding its internal PRNG from the system time, # so since we actually want randomization (including across machines) we # have to force it. entropy = os.urandom(64) test_method = hp.seed(int.from_bytes(entropy, 'big'))(test_method) return hp.settings(**kwds)(test_method)
def decorator(test_method): repro_seed = hypothesis_reproduction_seed() if repro_seed is not None: # This implements the semantics of TFP_HYPOTHESIS_REPRODUCE via # the `hp.reproduce_failure` decorator. # TODO(jburnim): Catch Hypothesis version mismatches. test_method = hp.reproduce_failure(hp.__version__, repro_seed)(test_method) elif randomize_hypothesis(): # Hypothesis defaults to seeding its internal PRNG from the system time, # so since we actually want randomization (including across machines) we # have to force it. entropy = os.urandom(64) test_method = hp.seed(int.from_bytes(entropy, 'big'))(test_method) if hp.__version_info__ >= (4,): # TODO(jburnim): Comment this. timeout = kwds.pop('timeout') ret = hp.settings(**kwds)(test_method) object.__setattr__(ret._hypothesis_internal_use_settings, 'timeout', timeout) else: ret = hp.settings(**kwds)(test_method) return ret