Repository: django-compressor/django-compressor

Issue:
test against django 1.11
per https://travis-ci.org/django-compressor/django-compressor the project is not tested against django 1.11


Discussion:
Would like to use this with django 1.11 too. Thanks for your work!

Resolving patch:
diff --git a/compressor/management/commands/compress.py b/compressor/management/commands/compress.py
--- a/compressor/management/commands/compress.py
+++ b/compressor/management/commands/compress.py
@@ -144,7 +144,7 @@ def compress(self, log=None, **options):
                     templates.update(os.path.join(root, name)
                         for name in files if not name.startswith('.') and
                             any(fnmatch(name, "*%s" % glob) for glob in extensions))
-        elif engine == 'jinja2' and django.VERSION >= (1, 8):
+        elif engine == 'jinja2':
             env = settings.COMPRESS_JINJA2_GET_ENVIRONMENT()
             if env and hasattr(env, 'list_templates'):
                 templates |= set([env.loader.get_source(env, template)[1] for template in
diff --git a/compressor/parser/default_htmlparser.py b/compressor/parser/default_htmlparser.py
--- a/compressor/parser/default_htmlparser.py
+++ b/compressor/parser/default_htmlparser.py
@@ -7,20 +7,10 @@
 from compressor.parser import ParserBase
 
 
-# Starting in Python 3.2, the HTMLParser constructor takes a 'strict'
-# argument which default to True (which we don't want).
-# In Python 3.3, it defaults to False.
-# In Python 3.4, passing it at all raises a deprecation warning.
-# So we only pass it for 3.2.
-# In Python 3.4, it also takes a 'convert_charrefs' argument
-# which raises a warning if we don't pass it.
-major, minor, release = sys.version_info[:3]
-CONSTRUCTOR_TAKES_STRICT = major == 3 and minor == 2
-CONSTRUCTOR_TAKES_CONVERT_CHARREFS = major == 3 and minor >= 4
+# Since Python 3.4, the HTMLParser constructor takes a 'convert_charrefs'
+# argument which raises a warning if we don't pass it.
 HTML_PARSER_ARGS = {}
-if CONSTRUCTOR_TAKES_STRICT:
-    HTML_PARSER_ARGS['strict'] = False
-if CONSTRUCTOR_TAKES_CONVERT_CHARREFS:
+if sys.version_info[:2] >= (3, 4):
     HTML_PARSER_ARGS['convert_charrefs'] = False
 
 


Test patch:
diff --git a/compressor/tests/test_jinja2ext.py b/compressor/tests/test_jinja2ext.py
--- a/compressor/tests/test_jinja2ext.py
+++ b/compressor/tests/test_jinja2ext.py
@@ -1,19 +1,13 @@
 # -*- coding: utf-8 -*-
 from __future__ import with_statement, unicode_literals
 
-import sys
-import unittest
-
 from django.test import TestCase
-from django.utils import six
 from django.test.utils import override_settings
 
 from compressor.conf import settings
 from compressor.tests.test_base import css_tag
 
 
-@unittest.skipIf(six.PY3 and sys.version_info[:2] < (3, 3),
-                     'Jinja can only run on Python < 3 and >= 3.3')
 class TestJinja2CompressorExtension(TestCase):
     """
     Test case for jinja2 extension.
diff --git a/compressor/tests/test_offline.py b/compressor/tests/test_offline.py
--- a/compressor/tests/test_offline.py
+++ b/compressor/tests/test_offline.py
@@ -3,8 +3,6 @@
 import django
 import io
 import os
-import sys
-import unittest
 from importlib import import_module
 
 from mock import patch
@@ -34,12 +32,6 @@
     except ImportError:
         from StringIO import StringIO
 
-# The Jinja2 tests fail on Python 3.2 due to the following:
-# The line in compressor/management/commands/compress.py:
-#     compressor_nodes.setdefault(template, []).extend(nodes)
-# causes the error 'unhashable type: 'Template''
-_TEST_JINJA2 = not(sys.version_info[0] == 3 and sys.version_info[1] == 2)
-
 
 def offline_context_generator():
     for i in range(1, 4):
@@ -57,10 +49,7 @@ class OfflineTestCaseMixin(object):
     templates_dir = ''
     expected_hash = ''
     # Engines to test
-    if _TEST_JINJA2:
-        engines = ('django', 'jinja2')
-    else:
-        engines = ('django',)
+    engines = ('django', 'jinja2')
     additional_test_settings = None
 
     def setUp(self):
@@ -247,7 +236,6 @@ def test_rendering_without_manifest_raises_exception(self):
         self.assertRaises(OfflineGenerationError,
                           self.template.render, Context({}))
 
-    @unittest.skipIf(not _TEST_JINJA2, 'No Jinja2 testing')
     def test_rendering_without_manifest_raises_exception_jinja2(self):
         # flush cached manifest
         flush_offline_manifest()
@@ -742,7 +730,6 @@ def _test_offline(self, engine):
         self.assertEqual(count, 1)
 
 
-@skipIf(not _TEST_JINJA2, "Test only run if we are testing Jinja2")
 class TestCompressCommand(OfflineTestCaseMixin, TestCase):
     templates_dir = "test_compress_command"
 
diff --git a/requirements/tests.txt b/requirements/tests.txt
--- a/requirements/tests.txt
+++ b/requirements/tests.txt
@@ -1,5 +1,5 @@
 flake8==2.4.0
-coverage==3.7.1
+coverage==4.4
 html5lib==0.9999999
 mock==1.0.1
 Jinja2==2.7.3