summaryrefslogtreecommitdiff
path: root/passlib/utils
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2012-05-01 12:40:12 -0400
committerEli Collins <elic@assurancetechnologies.com>2012-05-01 12:40:12 -0400
commit3fa87b2933ba2f596297297f97b8fc3e335ba581 (patch)
tree52ad1cbce3718d49e775afc4322b4cb8475ab9ef /passlib/utils
parent0f99c2a8d6106b980bb9b3c687669ae9fca5eb94 (diff)
downloadpasslib-3fa87b2933ba2f596297297f97b8fc3e335ba581.tar.gz
bunch bugfixes to the unittests
* timer issues under windows * id() issues under jython * mtime issues under jython & darwin * corrected expectations of test_ext_django's patch checker * added darwin flags to platform_os_crypt info * fixed regression in os_crypt backend test mocking
Diffstat (limited to 'passlib/utils')
-rw-r--r--passlib/utils/__init__.py25
-rw-r--r--passlib/utils/compat.py23
2 files changed, 15 insertions, 33 deletions
diff --git a/passlib/utils/__init__.py b/passlib/utils/__init__.py
index 1e086d3..a40b744 100644
--- a/passlib/utils/__init__.py
+++ b/passlib/utils/__init__.py
@@ -1396,31 +1396,6 @@ else:
# On most other platforms the best timer is time.time()
from time import time as tick
-# works but not used
-##def _get_timer_resolution(timer=timer, repeat=3):
-## best = None
-## i = 0
-## while i < repeat:
-## start = end = timer()
-## while start == end:
-## end = timer()
-## delta = end-start
-## if delta < 0:
-## # probably NTP adjust or some such.
-## log.error("timer jumped backwards! (%r => %r)", start, end)
-## continue
-## if delta > 1:
-## # should have at least this resolution,
-## # so probably NTP adjust or some such.
-## log.error("timer jumped too far! (%r => %r)", start, end)
-## continue
-## if best is None or delta < best:
-## best = delta
-## i += 1
-## return best
-##
-##timer_resolution = _get_timer_resolution()
-
#=================================================================================
# randomness
#=================================================================================
diff --git a/passlib/utils/compat.py b/passlib/utils/compat.py
index 02b808b..428e765 100644
--- a/passlib/utils/compat.py
+++ b/passlib/utils/compat.py
@@ -1,7 +1,11 @@
"""passlib.utils.compat - python 2/3 compatibility helpers"""
#=============================================================================
-# figure out what version we're running
+# figure out what we're running
#=============================================================================
+
+#-----------------------------------------------------
+# python version
+#-----------------------------------------------------
import sys
PY2 = sys.version_info < (3,0)
PY3 = sys.version_info >= (3,0)
@@ -9,16 +13,19 @@ PY_MAX_25 = sys.version_info < (2,6) # py 2.5 or earlier
PY27 = sys.version_info[:2] == (2,7) # supports last 2.x release
PY_MIN_32 = sys.version_info >= (3,2) # py 3.2 or later
-# __dir__() added in py2.6
-# NOTE: testing shows pypy1.5 doesn't either; but added somewhere <= 1.8
-SUPPORTS_DIR_METHOD = not PY_MAX_25
-
-#=============================================================================
-# figure out what VM we're running
-#=============================================================================
+#-----------------------------------------------------
+# python implementation
+#-----------------------------------------------------
PYPY = hasattr(sys, "pypy_version_info")
JYTHON = sys.platform.startswith('java')
+#-----------------------------------------------------
+# capabilities
+#-----------------------------------------------------
+
+# __dir__() added in py2.6
+SUPPORTS_DIR_METHOD = not PY_MAX_25 and not (PYPY and sys.pypy_version_info < (1,6))
+
#=============================================================================
# common imports
#=============================================================================