Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • passlib passlib
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 38
    • Issues 38
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • python-libs
  • passlibpasslib
  • Issues
  • #58

Closed
Open
Created Jul 28, 2015 by Bitbucket Importer@bitbucket_importerOwner

Test suite failure if os_crypt backend unavailable

Created originally on Bitbucket by Anonymous

======================================================================
ERROR: des_crypt (os_crypt backend): test per-call crypt() fallback
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/passlib-1.6.4/passlib/tests/utils.py", line 2065, in test_81_crypt_fallback
    if self.find_crypt_replacement(fallback=True):
  File "/builddir/build/BUILD/passlib-1.6.4/passlib/tests/utils.py", line 781, in find_crypt_replacement
    idx = handler.backends.index("os_crypt") + 1
AttributeError: 'tuple' object has no attribute 'index'

======================================================================
ERROR: ldap_md5_crypt (os_crypt backend): test per-call crypt() fallback
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/passlib-1.6.4/passlib/tests/utils.py", line 2065, in test_81_crypt_fallback
    if self.find_crypt_replacement(fallback=True):
  File "/builddir/build/BUILD/passlib-1.6.4/passlib/tests/utils.py", line 781, in     find_crypt_replacement
    idx = handler.backends.index("os_crypt") + 1
AttributeError: 'tuple' object has no attribute 'index'

======================================================================
ERROR: md5_crypt (os_crypt backend): test per-call crypt() fallback
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/passlib-1.6.4/passlib/tests/utils.py", line 2065, in test_81_crypt_fallback
    if self.find_crypt_replacement(fallback=True):
  File "/builddir/build/BUILD/passlib-1.6.4/passlib/tests/utils.py", line 781, in find_crypt_replacement
    idx = handler.backends.index("os_crypt") + 1
AttributeError: 'tuple' object has no attribute 'index'

======================================================================
ERROR: sha256_crypt (os_crypt backend): test per-call crypt() fallback
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/passlib-1.6.4/passlib/tests/utils.py", line 2065, in test_81_crypt_fallback
    if self.find_crypt_replacement(fallback=True):
  File "/builddir/build/BUILD/passlib-1.6.4/passlib/tests/utils.py", line 781, in find_crypt_replacement
    idx = handler.backends.index("os_crypt") + 1
AttributeError: 'tuple' object has no attribute 'index'

======================================================================
ERROR: sha512_crypt (os_crypt backend): test per-call crypt() fallback
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/passlib-1.6.4/passlib/tests/utils.py", line 2065, in test_81_crypt_fallback
    if self.find_crypt_replacement(fallback=True):
  File "/builddir/build/BUILD/passlib-1.6.4/passlib/tests/utils.py", line 781, in find_crypt_replacement
    idx = handler.backends.index("os_crypt") + 1
AttributeError: 'tuple' object has no attribute 'index'

----------------------------------------------------------------------
Ran 2391 tests in 186.628s

FAILED (errors=5)

This change fixes it for me:

--- passlib/tests/utils.py
+++ passlib/tests/utils.py
@@ -777,7 +777,7 @@
     def find_crypt_replacement(cls, fallback=False):
         """find other backend which can be used to mock the os_crypt backend"""
         handler = cls.handler
-        if fallback:
+        if fallback and handler.has_backend("os_crypt"):
             idx = handler.backends.index("os_crypt") + 1
         else:
             idx = 0
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking