pyoxidized: silence the fuzzywuzzy warning about python-Levenshtein stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 18 Aug 2021 15:05:25 +0200
branchstable
changeset 47847 8843de648aed
parent 47846 72c3b47d1557
child 47848 5f2b0d34f24d
pyoxidized: silence the fuzzywuzzy warning about python-Levenshtein I don't think we need the fast implementation for the test so lets ignore it for now. Differential Revision: https://phab.mercurial-scm.org/D11299
hgext/releasenotes.py
--- a/hgext/releasenotes.py	Wed Aug 18 13:16:04 2021 +0200
+++ b/hgext/releasenotes.py	Wed Aug 18 15:05:25 2021 +0200
@@ -39,9 +39,22 @@
 command = registrar.command(cmdtable)
 
 try:
-    import fuzzywuzzy.fuzz as fuzz
+    # Silence a warning about python-Levenshtein.
+    #
+    # We don't need the the performance that much and it get anoying in tests.
+    import warnings
 
-    fuzz.token_set_ratio
+    with warnings.catch_warnings():
+        warnings.filterwarnings(
+            action="ignore",
+            message=".*python-Levenshtein.*",
+            category=UserWarning,
+            module="fuzzywuzzy.fuzz",
+        )
+
+        import fuzzywuzzy.fuzz as fuzz
+
+        fuzz.token_set_ratio
 except ImportError:
     fuzz = None