aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_matching.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_matching.py')
-rw-r--r--tests/test_matching.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/test_matching.py b/tests/test_matching.py
index 7ab7b11..2122144 100644
--- a/tests/test_matching.py
+++ b/tests/test_matching.py
@@ -9,7 +9,8 @@ from fatcat_openapi_client import ReleaseEntity
from fuzzycat.entities import entity_from_dict
from fuzzycat.matching import anything_to_entity, match_release_fuzzy
-warnings.filterwarnings("ignore") # InsecureRequestWarning: Unverified HTTPS request is being made to host ...
+warnings.filterwarnings(
+ "ignore") # InsecureRequestWarning: Unverified HTTPS request is being made to host ...
from fuzzycat.matching import anything_to_entity, match_release_fuzzy
from fuzzycat.config import settings
@@ -28,6 +29,7 @@ FATCAT_SEARCH_URL = settings.get("FATCAT_SEARCH_URL", "https://search.fatcat.wik
def is_not_reachable(url, timeout=3):
return not is_reachable(url)
+
def is_reachable(url, timeout=3):
"""
Return true, if URL is reachable and returns HTTP 200.
@@ -37,14 +39,21 @@ def is_reachable(url, timeout=3):
except Exception:
return False
+
@pytest.fixture
def es_client():
return elasticsearch.Elasticsearch([FATCAT_SEARCH_URL])
-@pytest.mark.skipif(is_not_reachable(FATCAT_SEARCH_URL),
- reason="{} not reachable, use e.g. FUZZYCAT_FATCAT_SEARCH_URL=localhost:9200 to override".format(FATCAT_SEARCH_URL))
+@pytest.mark.skipif(
+ is_not_reachable(FATCAT_SEARCH_URL),
+ reason="{} not reachable, use e.g. FUZZYCAT_FATCAT_SEARCH_URL=localhost:9200 to override".
+ format(FATCAT_SEARCH_URL))
def test_match_release_fuzzy(es_client, caplog):
+ """
+ This test is tied to the current index contents, so if that changes, this
+ test may fail as well.
+ """
cases = (
("wtv64ahbdzgwnan7rllwr3nurm", 1),
("eqcgtpav3na5jh56o5vjsvb4ei", 1),