Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove special case for test harness from application code. #120

Merged
merged 2 commits into from
Oct 20, 2023

Commits on Oct 20, 2023

  1. Remove special case for test harness from application code.

    Addresses pydanny#88, at least partially.
    
    This adds a context manager that ensures django settings are reset on exit, and has the two unit tests that call `activate()` use it.
    
    It also adds two minimal settings modules that match the config those tests were seeing, and passes the names of those modules to `activate()` so that those are loaded using the same path as user-supplied settings modules.
    
    I thought about using pytest-django's settings fixture, but the way `activate()` and `Plus` interact made that smell more than the original hack.
    geoffbeier committed Oct 20, 2023
    Configuration menu
    Copy the full SHA
    988f14b View commit details
    Browse the repository at this point in the history
  2. In the new context manager, check to see whether the environment vari…

    …able got created before attempting to delete it. Tests that threw before setting the variable would terminate with a KeyError in the context manager instead of seeing their exceptions reported appropriately.
    geoffbeier committed Oct 20, 2023
    Configuration menu
    Copy the full SHA
    e83f802 View commit details
    Browse the repository at this point in the history