Ticket #18687: 18687.diff

File 18687.diff, 1.2 KB (added by aaugustin, 3 years ago)
  • tests/regressiontests/utils/crypto.py

    diff --git a/tests/regressiontests/utils/crypto.py b/tests/regressiontests/utils/crypto.py
    index 2bdc5ba..73a3642 100644
    a b class TestUtilsCryptoPBKDF2(unittest.TestCase): 
    139139        # These values are chosen as a reasonable tradeoff between time
    140140        # to run the test suite and false positives caused by imprecise
    141141        # measurement.
    142         n1, n2 = 200000, 800000
    143         elapsed = lambda f: timeit.Timer(f,
     142        n1, n2 = 1000, 20000
     143        elapsed = lambda f: timeit.Timer(f,
    144144                    'from django.utils.crypto import pbkdf2').timeit(number=1)
    145145        t1 = elapsed('pbkdf2("password", "salt", iterations=%d)' % n1)
    146146        t2 = elapsed('pbkdf2("password", "salt", iterations=%d)' % n2)
    147147        measured_scale_exponent = math.log(t2 / t1, n2 / n1)
    148         # This should be less than 1. We allow up to 1.2 so that tests don't
     148        # This should be less than 1. We allow up to 2.0 so that tests don't
    149149        # fail nondeterministically too often.
    150         self.assertLess(measured_scale_exponent, 1.2)
     150        self.assertLess(measured_scale_exponent, 2.0)
Back to Top