139 lines
6.2 KiB
Diff
139 lines
6.2 KiB
Diff
Source: https://foss.heptapod.net/python-libs/passlib/-/issues/191
|
|
--- a/passlib/_setup/stamp.py
|
|
+++ b/passlib/_setup/stamp.py
|
|
@@ -55,7 +55,7 @@
|
|
#
|
|
path = os.path.join(base_dir, "passlib", "__init__.py")
|
|
content = _get_file(path)
|
|
- content, count = re.subn('(?m)^__version__\s*=.*$',
|
|
+ content, count = re.subn(r'(?m)^__version__\s*=.*$',
|
|
'__version__ = ' + repr(version),
|
|
content)
|
|
assert count == 1, "failed to replace version string"
|
|
@@ -68,7 +68,7 @@
|
|
path = os.path.join(base_dir, "setup.py")
|
|
if os.path.exists(path):
|
|
content = _get_file(path)
|
|
- content, count = re.subn('(?m)^stamp_build\s*=.*$',
|
|
+ content, count = re.subn(r'(?m)^stamp_build\s*=.*$',
|
|
'stamp_build = False', content)
|
|
assert count == 1, "failed to update 'stamp_build' flag"
|
|
_replace_file(path, content, dry_run=dry_run)
|
|
--- a/passlib/tests/test_apache.py
|
|
+++ b/passlib/tests/test_apache.py
|
|
@@ -207,7 +207,7 @@
|
|
self.assertRaises(ValueError, ht.set_password, "user:", "pass")
|
|
|
|
# test that legacy update() still works
|
|
- with self.assertWarningList("update\(\) is deprecated"):
|
|
+ with self.assertWarningList(r"update\(\) is deprecated"):
|
|
ht.update("user2", "test")
|
|
self.assertTrue(ht.check_password("user2", "test"))
|
|
|
|
@@ -277,7 +277,7 @@
|
|
self.assertRaises(ValueError, ht.check_password, "user:", "pass")
|
|
|
|
# test that legacy verify() still works
|
|
- with self.assertWarningList(["verify\(\) is deprecated"]*2):
|
|
+ with self.assertWarningList([r"verify\(\) is deprecated"]*2):
|
|
self.assertTrue(ht.verify("user1", "pass1"))
|
|
self.assertFalse(ht.verify("user1", "pass2"))
|
|
|
|
@@ -367,7 +367,7 @@
|
|
self.assertEqual(ht.get_hash("user4"), b"pass4")
|
|
self.assertEqual(ht.get_hash("user5"), None)
|
|
|
|
- with self.assertWarningList("find\(\) is deprecated"):
|
|
+ with self.assertWarningList(r"find\(\) is deprecated"):
|
|
self.assertEqual(ht.find("user4"), b"pass4")
|
|
|
|
def test_09_to_string(self):
|
|
@@ -603,7 +603,7 @@
|
|
self.assertRaises(ValueError, ht.set_password, "user", "r"*256, "pass")
|
|
|
|
# test that legacy update() still works
|
|
- with self.assertWarningList("update\(\) is deprecated"):
|
|
+ with self.assertWarningList(r"update\(\) is deprecated"):
|
|
ht.update("user2", "realm2", "test")
|
|
self.assertTrue(ht.check_password("user2", "test"))
|
|
|
|
@@ -637,7 +637,7 @@
|
|
self.assertIs(ht.check_password("user5", "pass5"), None)
|
|
|
|
# test that legacy verify() still works
|
|
- with self.assertWarningList(["verify\(\) is deprecated"]*2):
|
|
+ with self.assertWarningList([r"verify\(\) is deprecated"]*2):
|
|
self.assertTrue(ht.verify("user1", "realm", "pass1"))
|
|
self.assertFalse(ht.verify("user1", "realm", "pass2"))
|
|
|
|
@@ -725,7 +725,7 @@
|
|
self.assertEqual(ht.get_hash("user4", "realm"), "ab7b5d5f28ccc7666315f508c7358519")
|
|
self.assertEqual(ht.get_hash("user5", "realm"), None)
|
|
|
|
- with self.assertWarningList("find\(\) is deprecated"):
|
|
+ with self.assertWarningList(r"find\(\) is deprecated"):
|
|
self.assertEqual(ht.find("user4", "realm"), "ab7b5d5f28ccc7666315f508c7358519")
|
|
|
|
def test_09_encodings(self):
|
|
--- a/passlib/tests/test_context_deprecated.py
|
|
+++ b/passlib/tests/test_context_deprecated.py
|
|
@@ -551,7 +551,7 @@
|
|
r"CryptContext\(\)\.replace\(\) has been deprecated.*")
|
|
warnings.filterwarnings("ignore",
|
|
r"The CryptContext ``policy`` keyword has been deprecated.*")
|
|
- warnings.filterwarnings("ignore", ".*(CryptPolicy|context\.policy).*(has|have) been deprecated.*")
|
|
+ warnings.filterwarnings("ignore", r".*(CryptPolicy|context\.policy).*(has|have) been deprecated.*")
|
|
warnings.filterwarnings("ignore",
|
|
r"the method.*hash_needs_update.*is deprecated")
|
|
|
|
@@ -704,7 +704,7 @@
|
|
# silence some warnings
|
|
warnings.filterwarnings("ignore",
|
|
r"CryptContext\(\)\.replace\(\) has been deprecated")
|
|
- warnings.filterwarnings("ignore", ".*(CryptPolicy|context\.policy).*(has|have) been deprecated.*")
|
|
+ warnings.filterwarnings("ignore", r".*(CryptPolicy|context\.policy).*(has|have) been deprecated.*")
|
|
|
|
def test_kwd_constructor(self):
|
|
"""test plain kwds"""
|
|
--- a/passlib/tests/test_ext_django.py
|
|
+++ b/passlib/tests/test_ext_django.py
|
|
@@ -913,7 +913,7 @@
|
|
# mess with User.set_password, make sure it's detected
|
|
orig = models.User.set_password
|
|
models.User.set_password = dummy
|
|
- with self.assertWarningList("another library has patched.*User\.set_password"):
|
|
+ with self.assertWarningList(r"another library has patched.*User\.set_password"):
|
|
adapter._manager.check_all()
|
|
models.User.set_password = orig
|
|
|
|
--- a/passlib/tests/test_handlers.py
|
|
+++ b/passlib/tests/test_handlers.py
|
|
@@ -1520,7 +1520,7 @@
|
|
filter_config_warnings = True # rounds too low, salt too small
|
|
|
|
platform_crypt_support = [
|
|
- ("freebsd(9|1\d)|linux", True),
|
|
+ (r"freebsd(9|1\d)|linux", True),
|
|
("freebsd8", None), # added in freebsd 8.3
|
|
("freebsd|openbsd|netbsd|darwin", False),
|
|
("solaris", None), # depends on policy
|
|
@@ -1758,7 +1758,7 @@
|
|
|
|
def test_90_special(self):
|
|
"""test marker option & special behavior"""
|
|
- warnings.filterwarnings("ignore", "passing settings to .*.hash\(\) is deprecated")
|
|
+ warnings.filterwarnings("ignore", r"passing settings to .*.hash\(\) is deprecated")
|
|
handler = self.handler
|
|
|
|
# preserve hash if provided
|
|
--- a/passlib/tests/test_utils.py
|
|
+++ b/passlib/tests/test_utils.py
|
|
@@ -141,7 +141,7 @@
|
|
def test_generate_password(self):
|
|
"""generate_password()"""
|
|
from passlib.utils import generate_password
|
|
- warnings.filterwarnings("ignore", "The function.*generate_password\(\) is deprecated")
|
|
+ warnings.filterwarnings("ignore", r"The function.*generate_password\(\) is deprecated")
|
|
self.assertEqual(len(generate_password(15)), 15)
|
|
|
|
def test_is_crypt_context(self):
|