From be1dbab99bf51b9e700102a676ed96fa7c462912 Mon Sep 17 00:00:00 2001 From: Daniel Axtens Date: Thu, 25 Jan 2018 13:43:17 +1100 Subject: [PATCH] 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 --- patchwork/tests/test_list.py | 2 +- patchwork/tests/test_mail_settings.py | 6 +++--- patchwork/tests/test_parser.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) 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.""" -- 2.47.3