diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2013-01-23 14:18:42 -0500 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2013-01-23 14:18:42 -0500 |
commit | 22ed9b953d3a4f6bff0999fe7e344a1b1034ab3d (patch) | |
tree | 51a712529f55727826618026f5ee71df214fcb3d /admin | |
parent | 951ac1222a827846d3e598fa39f1d1af94022ec4 (diff) | |
parent | 4c08f92f9caa64140e0010eae88179f260a28704 (diff) | |
download | passlib-22ed9b953d3a4f6bff0999fe7e344a1b1034ab3d.tar.gz |
Merge from stable
Diffstat (limited to 'admin')
-rw-r--r-- | admin/benchmarks.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/admin/benchmarks.py b/admin/benchmarks.py index 94f8610..dfe672a 100644 --- a/admin/benchmarks.py +++ b/admin/benchmarks.py @@ -6,7 +6,6 @@ parsing was being sped up. it could definitely be improved. #============================================================================= # init script env #============================================================================= -from binascii import hexlify import re import os, sys root = os.path.join(os.path.dirname(__file__), os.path.pardir) @@ -16,6 +15,7 @@ sys.path.insert(0, os.curdir) # imports #============================================================================= # core +from binascii import hexlify import logging; log = logging.getLogger(__name__) import os import warnings @@ -65,13 +65,9 @@ class benchmark: kwds = defaults.copy() kwds.update(options) if mode == "ctor": - itr = obj() - if not hasattr(itr, next_method_attr): - itr = [itr] - for func in itr: - # TODO: per function name & options - secs, precision = cls.measure(func, None, **kwds) - yield name, secs, precision + func = obj() + secs, precision = cls.measure(func, None, **kwds) + yield name, secs, precision else: raise ValueError("invalid mode: %r" % (mode,)) @@ -225,7 +221,7 @@ def test_md5_crypt_builtin(): hash = md5_crypt.encrypt(SECRET) md5_crypt.verify(SECRET, hash) md5_crypt.verify(OTHER, hash) - yield helper + return helper @benchmark.constructor() def test_ldap_salted_md5(): @@ -235,7 +231,7 @@ def test_ldap_salted_md5(): hash = handler.encrypt(SECRET, salt='....') handler.verify(SECRET, hash) handler.verify(OTHER, hash) - yield helper + return helper @benchmark.constructor() def test_phpass(): @@ -246,7 +242,7 @@ def test_phpass(): hash = handler.encrypt(SECRET, **kwds) handler.verify(SECRET, hash) handler.verify(OTHER, hash) - yield helper + return helper #============================================================================= # crypto utils |