Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-django-webpack-loader for 
openSUSE:Factory checked in at 2023-02-10 14:36:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-django-webpack-loader (Old)
 and      /work/SRC/openSUSE:Factory/.python-django-webpack-loader.new.1848 
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-django-webpack-loader"

Fri Feb 10 14:36:09 2023 rev:6 rq:1064210 version:1.8.1

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-django-webpack-loader/python-django-webpack-loader.changes
        2023-01-21 19:10:38.132981399 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-django-webpack-loader.new.1848/python-django-webpack-loader.changes
      2023-02-10 14:36:18.514274836 +0100
@@ -1,0 +2,6 @@
+Fri Feb 10 10:20:57 UTC 2023 - Dirk Müller <dmuel...@suse.com>
+
+- update to 1.8.1:
+  * Add a `FakeWebpackLoader` for running tests
+
+-------------------------------------------------------------------

Old:
----
  1.8.0.tar.gz

New:
----
  1.8.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-django-webpack-loader.spec ++++++
--- /var/tmp/diff_new_pack.hVhvBI/_old  2023-02-10 14:36:18.926277299 +0100
+++ /var/tmp/diff_new_pack.hVhvBI/_new  2023-02-10 14:36:18.934277347 +0100
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-django-webpack-loader
-Version:        1.8.0
+Version:        1.8.1
 Release:        0
 Summary:        Django plugin to transparently use webpack
 License:        MIT

++++++ 1.8.0.tar.gz -> 1.8.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-webpack-loader-1.8.0/CHANGELOG.md 
new/django-webpack-loader-1.8.1/CHANGELOG.md
--- old/django-webpack-loader-1.8.0/CHANGELOG.md        2022-12-09 
13:25:31.000000000 +0100
+++ new/django-webpack-loader-1.8.1/CHANGELOG.md        2023-02-06 
14:56:49.000000000 +0100
@@ -5,6 +5,9 @@
 Releases are added to the
 [github release 
page](https://github.com/ezhome/django-webpack-loader/releases).
 
+## [1.8.1] -- 2023-02-06
+- Add a `FakeWebpackLoader` for running tests
+
 ## [1.8.0] -- 2022-12-09
 - Add compatibility for Django 4.1 and Python 3.10
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-webpack-loader-1.8.0/README.md 
new/django-webpack-loader-1.8.1/README.md
--- old/django-webpack-loader-1.8.0/README.md   2022-12-09 13:25:31.000000000 
+0100
+++ new/django-webpack-loader-1.8.1/README.md   2023-02-06 14:56:49.000000000 
+0100
@@ -180,11 +180,11 @@
 However, production usage for this package is **fairly flexible**. Other 
approaches may include keeping the production bundles in the version control 
and take that responsibility from the automatic pipeline. However, you must 
remember to always build the frontend and generate the bundle before pushing to 
remote.
 
 ## Usage in tests
-There are 2 approaches for when `render_bundle` shows up in tests, since we 
don't have `webpack-bundle-tracker` at that point to generate the stats file.
+To run tests where `render_bundle` shows up, since we don't have 
`webpack-bundle-tracker` at that point to generate the stats file, the calls to 
render the bundle will fail. The solution is to use the `FakeWebpackLoader` in 
your test settings:
 
-1. The first approach is to have specific settings for them (which is how we 
approach on our 
[tests](https://github.com/django-webpack/django-webpack-loader/blob/master/tests/app/settings.py#L111-L125)),
 such as done 
[here](https://github.com/django-webpack/django-webpack-loader/issues/187#issuecomment-470055769).
 Please note that it's necessary to have a pre-made stats file for the tests 
(which in general can be empty, such as 
[here](https://github.com/django-webpack/django-webpack-loader/issues/187#issuecomment-464250721)).
-
-2. The second approach is to leverage [`LOADER_CLASS` 
overriding](#extra-settings) for the test settings and customize the 
`get_bundle` method to return the url of a stats file. Note that, using this 
approach, the stats file doesn't have to 
[exist](https://github.com/django-webpack/django-webpack-loader/issues/187#issuecomment-901449290).
+```python
+WEBPACK_LOADER['DEFAULT']['LOADER_CLASS'] = 
'webpack_loader.loader.FakeWebpackLoader'
+```
 
 ## Advanced Usage
 ### Rendering by file extension
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-webpack-loader-1.8.0/requirements-dev.txt 
new/django-webpack-loader-1.8.1/requirements-dev.txt
--- old/django-webpack-loader-1.8.0/requirements-dev.txt        2022-12-09 
13:25:31.000000000 +0100
+++ new/django-webpack-loader-1.8.1/requirements-dev.txt        2023-02-06 
14:56:49.000000000 +0100
@@ -1,5 +1,5 @@
 twine==3.4.1
-Django==3.2.16
+Django==3.2.17
 django-jinja==2.7.0
 unittest2==1.1.0
-wheel==0.36.2
+wheel==0.38.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-webpack-loader-1.8.0/tests/package.json 
new/django-webpack-loader-1.8.1/tests/package.json
--- old/django-webpack-loader-1.8.0/tests/package.json  2022-12-09 
13:25:31.000000000 +0100
+++ new/django-webpack-loader-1.8.1/tests/package.json  2023-02-06 
14:56:49.000000000 +0100
@@ -15,7 +15,7 @@
     "react": "^16.0.0",
     "webpack": "^4.0.0",
     "compression-webpack-plugin": "^6.1.1",
-    "webpack-bundle-tracker": "1.8.0",
+    "webpack-bundle-tracker": "1.8.1",
     "webpack-cli": "^3.3.10",
     "webpack-dev-server": "^3.0.0"
   }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/django-webpack-loader-1.8.0/webpack_loader/__init__.py 
new/django-webpack-loader-1.8.1/webpack_loader/__init__.py
--- old/django-webpack-loader-1.8.0/webpack_loader/__init__.py  2022-12-09 
13:25:31.000000000 +0100
+++ new/django-webpack-loader-1.8.1/webpack_loader/__init__.py  2023-02-06 
14:56:49.000000000 +0100
@@ -1,5 +1,5 @@
 __author__ = 'Owais Lone'
-__version__ = '1.8.0'
+__version__ = '1.8.1'
 
 import django
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-webpack-loader-1.8.0/webpack_loader/loader.py 
new/django-webpack-loader-1.8.1/webpack_loader/loader.py
--- old/django-webpack-loader-1.8.0/webpack_loader/loader.py    2022-12-09 
13:25:31.000000000 +0100
+++ new/django-webpack-loader-1.8.1/webpack_loader/loader.py    2023-02-06 
14:56:49.000000000 +0100
@@ -139,3 +139,19 @@
             "The stats file does not contain valid data. Make sure "
             "webpack-bundle-tracker plugin is enabled and try to run "
             "webpack again.")
+
+
+class FakeWebpackLoader(WebpackLoader):
+    """
+    A fake loader to help run Django tests.
+
+    For running tests where `render_bundle` is used but assets aren't built.
+    """
+
+    def get_bundle(self, _bundle_name):
+        return [
+            {
+                'name': 'test.bundle.js',
+                'url': 'http://localhost/static/bundles/test.bundle.js',
+            }
+        ]

Reply via email to