Run Pyupgrade on pipeline mako.
This commit is contained in:
Awais Qureshi
2021-02-23 16:28:50 +05:00
parent 4303e5c77a
commit 23007c423c
2 changed files with 6 additions and 7 deletions

View File

@@ -140,6 +140,6 @@ def render_require_js_path_overrides(path_overrides):
# RequireJS also already has a base URL set to the base static URL, so we can remove that.
path = actual_url.replace('.js', '').replace(django_settings.STATIC_URL, '')
new_paths.append("'{module}': '{path}'".format(module=module, path=path))
new_paths.append(f"'{module}': '{path}'")
return html.format(overrides=',\n'.join(new_paths))

View File

@@ -2,12 +2,11 @@
from unittest import skipUnless
from unittest.mock import patch
import ddt
from django.conf import settings
from django.test import TestCase
from mock import patch
from six.moves import map
from common.djangoapps.pipeline_mako import compressed_css, compressed_js, render_require_js_path_overrides
@@ -65,11 +64,11 @@ class PipelineRenderTest(TestCase):
with self.settings(PIPELINE=pipeline):
# Verify the default behavior
css_include = compressed_css('style-main-v1')
assert u'lms-main-v1.css' in css_include
assert 'lms-main-v1.css' in css_include
# Verify that raw keyword causes raw URLs to be emitted
css_include = compressed_css('style-main-v1', raw=True)
assert u'lms-main-v1.css?raw' in css_include
assert 'lms-main-v1.css?raw' in css_include
@patch('django.contrib.staticfiles.storage.staticfiles_storage.exists', return_value=True)
@patch('common.djangoapps.static_replace.try_staticfiles_lookup', side_effect=mock_staticfiles_lookup)
@@ -83,10 +82,10 @@ class PipelineRenderTest(TestCase):
pipeline['PIPELINE_ENABLED'] = True
with self.settings(PIPELINE=pipeline):
js_include = compressed_js('base_application')
assert u'lms-base-application.js' in js_include
assert 'lms-base-application.js' in js_include
# Verify that multiple JS files are rendered with the pipeline disabled
pipeline['PIPELINE_ENABLED'] = False
with self.settings(PIPELINE=pipeline):
js_include = compressed_js('base_application')
assert u'/static/js/src/logger.js' in js_include
assert '/static/js/src/logger.js' in js_include