Tests fail with Django 1.9

Issue #68 resolved
Brian May created an issue

Lots of "AppRegistryNotReady: Apps aren't loaded yet." errors.

Full log of a build of the Debian package is attached.

Comments (6)

  1. Eli Collins repo owner

    It looks like Django 1.9 made some fundamental change in how Django is initialized, that's not compatible with the (admittedly non-standard) manner that passlib's tests need to initialize things.

    In particular, unless I'm misreading something, it no longer allows importing a model object before initializing the application (!?)

    I'm not that familiar with Django's internals, so it may take some time to track down what they changed and how to fix it.

  2. Eli Collins repo owner

    Update to this issue...

    I've tracked down what changed in Django 1.9, and was able to get the tests to pass again. Outside of an import problem in hasher.safe_summary(), it doesn't look like there's anything broken in passlib w/r/t Django 1.9... just some incompatibilities in the unittests. So outside of safe_summary(), passlib 1.6.5 should be safe to use.

    Getting the tests to work again ended up depending on a bunch of other minor bugfixes / improvements in passlib, which are still incomplete & need some tests written. Hope to have that job finished and committed within the next week.

  3. Eli Collins repo owner

    passlib.ext.django: fixes so we're compatible with django 1.9, fixes issue 68

    failures were mostly in the unittests, not in passlib proper. however, to get things working, ended up making some internal improvements to django integration.

    • passlib.ext.django now patches get_hashers() for django 1.8+

    • the (still internal) _PasslibHasherWrapper, which wraps a passlib hash in a django-hasher-compatible api, got an overhaul:

      • 'rounds' and 'iterations' attributes now populated from underlying passlib hasher, so inspecting them gives sane result.

      • now autohandles 'rounds' vs 'iterations' to match expected django api.

      • bugfix: correct OrderedDict import removed in django 1.9

      • .must_update() now mimics django's semantics, using wrapped handler.parse_rounds(). previously just always returned False.

      • NOTE: all these changes bring this thing much closer to be able to provide passlib handlers TO django, rather than having to patch entire django framework.

    • unittests

      • django 1.7+: populate django apps before test; required as of 1.9

      • added rounds settings required for 1.9 test to function

      • django tests integratio - now keeps context in sync for all hashers, not just pbkdf2_sha256; needed to pass some django 1.9 tests.

    • django 1.8 is LTS, and <= 1.7 is EOLed, per https://www.djangoproject.com/download/; so now planning to drop django 1.6 / 1.7 support in passlib 1.7.

    → <<cset c3311609a545>>

  4. Log in to comment