Syncing DEFAULT_FILE_STORAGE/STATICFILES_STORAGE settings with STORAGES can mutate user settings. An isolation issue can be observed by running tests in the specific order, e.g.
./runtests.py deprecation staticfiles_tests --shuffle=1352276316 --parallel=1
...
======================================================================
ERROR: test_no_warning_when_staticdir_does_not_exist (staticfiles_tests.test_management.TestInteractiveMessages)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/django/tests/staticfiles_tests/cases.py", line 77, in setUp
self.run_collectstatic()
File "/django/tests/staticfiles_tests/cases.py", line 89, in run_collectstatic
call_command(
File "/django/django/core/management/__init__.py", line 194, in call_command
return command.execute(*args, **defaults)
File "/django/django/core/management/base.py", line 458, in execute
output = self.handle(*args, **options)
File "/django/django/contrib/staticfiles/management/commands/collectstatic.py", line 209, in handle
collected = self.collect()
File "/django/django/contrib/staticfiles/management/commands/collectstatic.py", line 126, in collect
for path, storage in finder.list(self.ignore_patterns):
File "/django/django/contrib/staticfiles/finders.py", line 266, in list
for path in utils.get_files(self.storage, ignore_patterns):
File "/django/django/contrib/staticfiles/utils.py", line 23, in get_files
directories, files = storage.listdir(location)
File "/django/django/core/files/storage/base.py", line 148, in listdir
raise NotImplementedError(
NotImplementedError: subclasses of Storage must provide a listdir() method
======================================================================
FAIL: test_location_empty (staticfiles_tests.test_finders.TestMiscFinder)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/django/django/test/utils.py", line 443, in inner
return func(*args, **kwargs)
File "/django/tests/staticfiles_tests/test_finders.py", line 124, in test_location_empty
with self.assertRaisesMessage(ImproperlyConfigured, msg):
File "/usr/local/lib/python3.10/contextlib.py", line 142, in __exit__
next(self.gen)
File "/django/django/test/testcases.py", line 739, in _assert_raises_or_warns_cm
with func(expected_exception) as cm:
AssertionError: ImproperlyConfigured not raised
----------------------------------------------------------------------
Ran 203 tests in 3.158s
FAILED (failures=1, errors=69)
Used shuffle seed: 1352276316 (given)
Destroying test database for alias 'default'...
Regression in 6b965c600054f970bdf94017ecf2e0e6e0a4326b (check out #34773).
PR