Don't reload settings in rb-site upgrade during unit tests.
Review Request #11436 — Created Feb. 8, 2021 and submitted
When
rb-site upgrade
determines it needs to update settings, it first
writes a newsettings_local.py
file and then reloads Django's internal
settings.The way it reloaded settings wasn't very safe, and that's been fixed up,
but the entire block of logic for reloading settings is problematic in
unit tests. While the unit tests for settings migration work fine, they
impact other unit tests. This happens by removing the cached
settings_local
module in Python and then immediately triggering a
reload.Since the unit tests are working with test versions of this file, what
we end up doing is finishing the test suite withdjango.conf.settings
wrapping a test version ofsettings_local.py
. Future unit tests are
then sensitive to this, and blow up.The code has been updated to only perform a settings reload if we know
that thesettings_local
in cache is the same one containing settings
we're migrating. This will be true when runningrb-site upgrade
, but
won't be when performing unit tests.
All unit tests that failed due to this issue now pass.
Summary | ID |
---|---|
6eb48925216c1d621451ea83196fed23278de424 |