[damned-lies] fix: remove unicode characters from setup.cfg



commit 3f37e2d149d65e2430884e560aa8257aed011cc8
Author: Claude Paroz <claude 2xlibre net>
Date:   Fri May 7 13:59:43 2021 +0200

    fix: remove unicode characters from setup.cfg
    
    Thanks Guillaume Bernard for the initial patch.

 common/tests.py | 13 +++++++++++++
 setup.cfg       |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/common/tests.py b/common/tests.py
index e2863e87..56b8f9df 100644
--- a/common/tests.py
+++ b/common/tests.py
@@ -1,5 +1,6 @@
 import operator
 from datetime import datetime, timedelta
+from pathlib import Path
 from unittest import TestCase, skipUnless
 from unittest.mock import MagicMock, patch
 
@@ -16,6 +17,18 @@ from .utils import lc_sorted, pyicu_present, trans_sort_object_list
 
 
 class CommonTest(DjangoTestCase):
+    def test_setup_cfg_ascii(self):
+        """
+        setup.cfg is read by setuptools during the installation process,
+        which cannot understand unicode characters.
+        """
+        setup_path = Path(__file__).parent.parent / 'setup.cfg'
+        with setup_path.open('rb') as fh:
+            try:
+                fh.read().decode('ascii')
+            except UnicodeDecodeError:
+                self.fail("setup.cfg contains non-ASCII chars")
+
     def test_admin_login(self):
         response = self.client.get(reverse('admin:index'))
         self.assertRedirects(response, reverse('admin:login') + '?next=' + reverse('admin:index'))
diff --git a/setup.cfg b/setup.cfg
index 5bed1c43..363de5d6 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -16,7 +16,7 @@ omit =
     */migrations/*
     # Empty files in general
     */__init__.py
-    # Tests are always 100% ”Tested”
+    # Tests are always 100% 'Tested'
     */tests.py
     */tests/*
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]