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

Adds tests for invalid template variables #222

Merged
merged 1 commit into from
Jul 25, 2015
Merged

Commits on Jun 3, 2015

  1. Adds tests for invalid template variables

    Django catches all `VariableDoesNotExist` exceptions to replace
    them in templates with a modifiable string that you can define in
    your settings.
    Sadly that doesn't allow you to find them in unit tests.
    
    `_fail_for_invalid_template_variable` sets the setting
    `TEMPLATE_STRING_IF_INVALID` to a custom class that not only fails
    the current test but prints a pretty message including the template
    name.
    
    This behavior can be used with the new `--test-templates` command line option.
    A new marker allows disabling this behavior, eg:
    
        @pytest.mark.ignore_template_errors
        def test_something():
            pass
    
    This marker sets the setting to None, if you want it to be a string,
    you can use the `settings` fixture to set it to your desired value.
    codingjoe committed Jun 3, 2015
    Configuration menu
    Copy the full SHA
    954081f View commit details
    Browse the repository at this point in the history