Repository: mahmoud/clastic (language: python)

Issue:
Finally dropping Python 2
With Montage now moving to Python 3, Clastic can, too. Hardly needs justification in 2023, but this greatly simplifies dependency management / testing / CI.


Discussion / hints:

Fix patch:
diff --git a/.gitignore b/.gitignore
index e2845e5..4f4e08c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@ htmlcov/
 tmp.py
 examples/cline/todo.db
 *.py[cod]
+venv*
 
 # emacs
 *~
diff --git a/requirements.in b/requirements.in
index 558c36b..7c70ab0 100644
--- a/requirements.in
+++ b/requirements.in
@@ -1,7 +1,9 @@
 ashes
 boltons
-chameleon<3.10  # 4.0 dropped 2.7 support, 3.10 made scopes dict-like in a way that breaks tests
-coverage
+# 4.3.0 fixed the long-running dict iterability issue, see chameleon #390
+chameleon>=4.4.1;python_version >= '3.8'
+chameleon<=3.9.1;python_version < '3.8'
+coverage<=7.2.7
 face
 mako
 pip-tools
diff --git a/requirements.txt b/requirements.txt
index 3c7fd02..92b8d41 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -8,7 +8,8 @@ ashes==19.2.0             # via -r requirements.in
 boltons==23.1.1           # via -r requirements.in, face
 build==1.0.3              # via pip-tools
 cachetools==5.3.2         # via tox
-chameleon==3.9.1          # via -r requirements.in
+chameleon==3.9.1 ; python_version < "3.8"  # via -r requirements.in
+chameleon==4.4.1 ; python_version >= "3.8"  # via -r requirements.in
 chardet==5.2.0            # via tox
 click==8.1.7              # via pip-tools
 colorama==0.4.6           # via tox
diff --git a/setup.py b/setup.py
index 6012ba8..14a7092 100644
--- a/setup.py
+++ b/setup.py
@@ -55,7 +55,7 @@ def import_path(module_name, path):
       license=__license__,
       platforms='any',
       tests_require=[
-          'chameleon==3.9.1',
+          'chameleon>=4.4.1',
           'Mako', 
           'pytest', 
           'psutil'],
diff --git a/tox.ini b/tox.ini
index 491c93c..8268d4b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,6 +6,13 @@ changedir = .tox
 deps = -rrequirements.txt
 commands = coverage run --parallel --rcfile {toxinidir}/.tox-coveragerc -m pytest {envsitepackagesdir}/clastic {posargs}
 
+[testenv:py311]
+# chameleon 4.3.0 is broken on windows, and 4.4.0 dropped py3.7
+# when dropping py3.7, can remove this
+deps = 
+   -rrequirements.txt 
+   chameleon>=4.4.1
+
 [testenv:coverage-report]
 depends = py37,py38,py39,py310,py311,pypy3
 changedir = .tox


Test patch:
diff --git a/clastic/tests/test_chameleon_render.py b/clastic/tests/test_chameleon_render.py
index a525830..dd2db30 100644
--- a/clastic/tests/test_chameleon_render.py
+++ b/clastic/tests/test_chameleon_render.py
@@ -58,8 +58,8 @@ def test_chameleon_mixed():
 
     c = app.get_local_client()
     resp = c.get('/')
-    assert resp.status_code == 200
+    assert resp.status_code == 200, resp.data
     assert b'clasty' in resp.data
 
     resp = c.get('/json/')
-    assert resp.status_code == 200
+    assert resp.status_code == 200, resp.data