Git Product home page Git Product logo

Comments (8)

al45tair avatar al45tair commented on July 3, 2024

It took me a couple of goes to figure out how to run the tests (not least because the settings.py needs a patch to make it work with Django 1.8).

It looks to me as if this is primarily a bug in the tests. What appears to be happening is that Django 1.8 (and possibly 1.7 as well) build their app registry before the test code edits INSTALLED_APPS, with the result that the only application Django knows about is overextends. I’m not sure how to fix that; the app registry doesn’t have any public API to add applications. The most sensible approach is probably to build the test in a static configuration, rather than trying to dynamically generate and add applications, but I think that’s something for you to decide as the package author.

There is also an additional bug in that calling loader.load_template_source(name, []) will actually find the template (if you check the Django sources, you’ll see that it does if not template_dirs rather than if template_dirs is None when deciding whether you specified template directories to search). Thus there should be an

if not dirs:
    break

in the code in overextends_tags.py.

I've submitted another pull request to fix the problem of the tests not running because of the code in settings.py, and also to add the above change in overextends_tags.py. That doesn’t change the fact that the tests are going to continue breaking because of the application registry problem.

from django-overextends.

al45tair avatar al45tair commented on July 3, 2024

Note that #17 does not completely fix this problem because a decision needs to be made about how to fix the test rig.

from django-overextends.

stephenmcd avatar stephenmcd commented on July 3, 2024

Maybe if we somehow used override_settings decorator on INSTALLED_APPS we could maintain the current behaviour?

https://docs.djangoproject.com/en/1.8/topics/testing/tools/#overriding-settings

Also just discovered a new modify_settings API as for Django 1.7:

https://docs.djangoproject.com/en/1.8/topics/testing/tools/#django.test.SimpleTestCase.modify_settings

That matches more closely to what the tests are currently doing, and might be a lot easier to work with (since the decorators need to run at import time). I think it would be fine to drop support for Django 1.6 and earlier - what do you think?

from django-overextends.

stephenmcd avatar stephenmcd commented on July 3, 2024

BTW thanks for going to all the trouble of diving deeply into this, it's really appreciated.

from django-overextends.

jleclanche avatar jleclanche commented on July 3, 2024

@stephenmcd Django 1.6 doesn't need to be supported imo since 1.7 is a LTS, yes. modify_settings looks good.

from django-overextends.

stephenmcd avatar stephenmcd commented on July 3, 2024

@jleclanche want to try and finish it off then?

from django-overextends.

jleclanche avatar jleclanche commented on July 3, 2024

I can't take care of it for a while I'm afraid.

from django-overextends.

stephenmcd avatar stephenmcd commented on July 3, 2024

No problem! I just assumed you needed it now.

from django-overextends.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.