string_if_invalid can be a useful debugging tool, it is a bad
idea to turn it on as a ‘development default’.Why not have a second batch of tests that use a settings.py file with a non default value for "string_if_invalid" that runs if the default settings file passes? I've never dealt with a CI platform, but I'm assuming you can do something like that.
- James
A second batch of tests?
I am unsure if I understood you: Do you mean new tests, or running the same
tests again, with a different settings file?
If the first: write new tests: How should these tests be different from the existing tests?
If the second: Why not run the test with the settings which have string_if_invalid enabled in the first run?
What do you gain by running the tests twice?
A second batch of tests?
I am unsure if I understood you: Do you mean new tests, or running the same
tests again, with a different settings file?I meant the latter. Sorry for not being clear.
If the first: write new tests: How should these tests be different from the existing tests?
If the second: Why not run the test with the settings which have string_if_invalid enabled in the first run?
What do you gain by running the tests twice?The two sets of tests could potentially provide two sets of differing results. The development setting you want to change is known to negatively interact with templates used by the Django admin and probably third-party applications that provide templates, per the link that you provided. With that setting changed, you are testing an application that intentionally behaves differently than what will be seen in production. That makes me uncomfortable.
For me, that means running two sets of tests. One of them will closely match the production settings (probably the settings file you're using now), and the other can be tweaked to potentially catch edge-cases or other uncommon bugs that you can/have run in to, or other failure points that may not be easily exposed by the standard settings file. Perhaps the second customized set of tests may not be something that you build into your CI, but may be part of a manual examination performed at various milestones. It would depend on your workflow and CI process, and how often you think these particular bugs may present themselves. Maybe only as a pre-release final check?
Or, if you don't use the admin or any 3rd party applications, you may be safe in enabling it. I personally wouldn't unless I was also doing so in production.
We have no "pre-release final check/test". We run the whole test-suite twice daily. This is done automatically be jenkins.
We try to automate as much as possible. Manual examination is possible, but who wants to do this? I would like to have it automated.
All tests run in around 10 minutes.
I guess we will see bugs like four times per year.
With "like this" I mean:
* bugs caused by the template engine returning the empy string instead of an exception
* bugs which are not detected by CI and get into production