From: Daniel Axtens Date: Thu, 25 Jan 2018 02:43:17 +0000 (+1100) Subject: Fix Python3.6 depreciation warnings X-Git-Tag: v2.1.0-rc1~69 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=be1dbab99bf51b9e700102a676ed96fa7c462912;p=thirdparty%2Fpatchwork.git Fix Python3.6 depreciation warnings 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(']*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 Reviewed-by: Stephen Finucane --- diff --git a/patchwork/tests/test_list.py b/patchwork/tests/test_list.py index 11b9da9c..2a023ac6 100644 --- a/patchwork/tests/test_list.py +++ b/patchwork/tests/test_list.py @@ -76,7 +76,7 @@ class PatchOrderTest(TestCase): date=date) def _extract_patch_ids(self, response): - id_re = re.compile(']*action="%(url)s"[^>]*>' - '.*?]*value="%(email)s"[^>]*>.*?' - '') + form_re_template = (r']*action="%(url)s"[^>]*>' + r'.*?]*value="%(email)s"[^>]*>.*?' + r'') def setUp(self): self.secondary_email = 'test2@example.com' diff --git a/patchwork/tests/test_parser.py b/patchwork/tests/test_parser.py index 42f96fe7..fbc85993 100644 --- a/patchwork/tests/test_parser.py +++ b/patchwork/tests/test_parser.py @@ -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."""