def test_init_with_non_default_staticfiles_storage(self): """ Non-default STATICFILES_STORAGE (ex. django.contrib.staticfiles.storage.ManifestStaticFilesStorage) might raise ValueError when file could not be found by this storage and DEBUG is set to False. Ensure that _normalize_plugins_config calls `static` lazily, in order to let the `collectstatic` command to run. """ try: with self.settings(STATICFILES_STORAGE='leaflet.tests.tests.DummyStaticFilesStorage', STATIC_ROOT="/", DEBUG=False): staticfiles_storage._setup() # reset already initialized (and memoized) default STATICFILES_STORAGE with self.assertRaises(ValueError): # Ensure that our DummyStaticFilesStorage is unable to process `static` calls right now static("a") PLUGINS.update({ 'a': {'css': 'a'}, }) PLUGINS.pop('__is_normalized__') # This would raise if `static` calls are not lazy _normalize_plugins_config() finally: # Reset the STATICFILES_STORAGE to a default one staticfiles_storage._setup() _normalize_plugins_config()
def test_post_process_no_path(self): """ Test post_process with a storage that doesn't implement the path method. """ staticfiles_storage._setup() try: call_command('collectstatic', verbosity=0, interactive=False) except NotImplementedError: self.fail('Received an error running collectstatic')
def test_post_process_no_path(self): """ Test post_process with a storage that doesn't implement the path method. """ staticfiles_storage._setup() try: call_command('collectstatic', verbosity=0, interactive=False) except NotImplementedError: self.fail('Received an error running collectstatic')
def test_post_process_no_path(self): """ Test post_process with a storage that doesn't implement the path method. """ with override_settings(STATICFILES_STORAGE='tests.tests.test_storage.PipelineNoPathStorage', PIPELINE_COMPILERS=['tests.tests.test_storage.DummyCSSCompiler']): with pipeline_settings(PIPELINE_JS_COMPRESSOR=None, PIPELINE_CSS_COMPRESSOR=None): staticfiles_storage._setup() try: call_command('collectstatic', verbosity=0, interactive=False) except NotImplementedError: self.fail('Received an error running collectstatic')
def test_post_process_no_path(self): """ Test post_process with a storage that doesn't implement the path method. """ with override_settings( STATICFILES_STORAGE= 'tests.tests.test_storage.PipelineNoPathStorage', PIPELINE_COMPILERS=[ 'tests.tests.test_storage.DummyCSSCompiler' ]): with pipeline_settings(PIPELINE_JS_COMPRESSOR=None, PIPELINE_CSS_COMPRESSOR=None): staticfiles_storage._setup() try: call_command('collectstatic', verbosity=0, interactive=False) except NotImplementedError: self.fail('Received an error running collectstatic')
def _reset_storage(self): """To re-apply any overridden storage settings""" from django.contrib.staticfiles.storage import staticfiles_storage staticfiles_storage._setup()
def tearDown(self): staticfiles_storage._setup()
def tearDown(self): staticfiles_storage._setup()
def tearDown(self): super(ServeStaticViewsTest, self).tearDown() default_collector.clear() staticfiles_storage._setup()
def _reset_storage(self): """To re-apply any overridden storage settings""" from django.contrib.staticfiles.storage import staticfiles_storage staticfiles_storage._setup()