[pygobject] tests: avoid deprecation warnings for assertRegexpMatches/assertRaisesRegexp



commit ed488be1f0bcd2d2ec1acf98f27585d8577ddc5f
Author: Christoph Reiter <creiter src gnome org>
Date:   Sat Apr 1 18:05:13 2017 +0200

    tests: avoid deprecation warnings for assertRegexpMatches/assertRaisesRegexp
    
    Replace them with the renamed variants. We can't switch because there is
    no non-deprecated variant available under both Python 2 and 3.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780812

 tests/runtests.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/tests/runtests.py b/tests/runtests.py
index 6c89f9b..92bed2e 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -11,6 +11,11 @@ import unittest
 if sys.version_info[:2] == (2, 7):
     unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
 
+if sys.version_info[0] == 3:
+    unittest.TestCase.assertRegexpMatches = unittest.TestCase.assertRegex
+    unittest.TestCase.assertRaisesRegexp = unittest.TestCase.assertRaisesRegex
+
+
 if '--help' in sys.argv:
     print("Usage: ./runtests.py <testfiles>")
     sys.exit(0)


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