]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
Fix Python3.6 depreciation warnings
authorDaniel Axtens <dja@axtens.net>
Thu, 25 Jan 2018 02:43:17 +0000 (13:43 +1100)
committerStephen Finucane <stephen@that.guru>
Fri, 26 Jan 2018 21:42:58 +0000 (21:42 +0000)
We see on Travis and on tox:
/home/travis/build/daxtens/patchwork/patchwork/tests/test_list.py:79: DeprecationWarning: invalid escape sequence \d
  id_re = re.compile('<tr id="patch_row:(\d+)"')
/home/travis/build/daxtens/patchwork/patchwork/tests/test_mail_settings.py:248: DeprecationWarning: invalid escape sequence \s
  form_re_template = ('<form\s+[^>]*action="%(url)s"[^>]*>'
/home/travis/build/daxtens/patchwork/patchwork/tests/test_parser.py:616: DeprecationWarning: invalid escape sequence \
  '\ No newline at end of file'))

All of these are easy to fix: just mark them as raw strings.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephen@that.guru>
patchwork/tests/test_list.py
patchwork/tests/test_mail_settings.py
patchwork/tests/test_parser.py

index 11b9da9c11d381454e1afaabaf4038cb51b18b52..2a023ac6d7f1d22290ec0edb2acba23ee7138abc 100644 (file)
@@ -76,7 +76,7 @@ class PatchOrderTest(TestCase):
                          date=date)
 
     def _extract_patch_ids(self, response):
-        id_re = re.compile('<tr id="patch_row:(\d+)"')
+        id_re = re.compile(r'<tr id="patch_row:(\d+)"')
         ids = [int(m.group(1))
                for m in id_re.finditer(response.content.decode())]
 
index 1eb49753440419a62da629b6311e317219d5ed08..d38149d86425f6aebc3bf930d81431d49538c50b 100644 (file)
@@ -245,9 +245,9 @@ class UserProfileOptoutFormTest(TestCase):
 
     """Validate presence of correct optin/optout forms."""
 
-    form_re_template = ('<form\s+[^>]*action="%(url)s"[^>]*>'
-                        '.*?<input\s+[^>]*value="%(email)s"[^>]*>.*?'
-                        '</form>')
+    form_re_template = (r'<form\s+[^>]*action="%(url)s"[^>]*>'
+                        r'.*?<input\s+[^>]*value="%(email)s"[^>]*>.*?'
+                        r'</form>')
 
     def setUp(self):
         self.secondary_email = 'test2@example.com'
index 42f96fe7fc79ca92468d99dd0bf1af3d89fe4104..fbc85993d8997187f9705692dc13260f2fe38735 100644 (file)
@@ -613,12 +613,12 @@ class PatchParseTest(PatchTest):
             'diff --git a/tools/testing/selftests/powerpc/Makefile'))
         # Confirm the trailing no newline marker doesn't end up in the comment
         self.assertFalse(message.rstrip().endswith(
-            '\ No newline at end of file'))
+            r'\ No newline at end of file'))
         # Confirm it's instead at the bottom of the patch
         self.assertTrue(diff.rstrip().endswith(
-            '\ No newline at end of file'))
+            r'\ No newline at end of file'))
         # Confirm we got both markers
-        self.assertEqual(2, diff.count('\ No newline at end of file'))
+        self.assertEqual(2, diff.count(r'\ No newline at end of file'))
 
     def test_no_subject(self):
         """Validate parsing a mail with no subject."""