Skip Bing tests when no API key is present. (#3757)

* Skip Bing pytests when no API key is present.

* Fixed formatting.

---------

Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
This commit is contained in:
afourney 2024-10-11 09:07:31 -07:00 committed by GitHub
parent c48d0d7867
commit e1e9d19cb4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,17 +17,6 @@ BING_STRING = f"A Bing search for '{BING_QUERY}' found"
BING_EXPECTED_RESULT = "https://en.wikipedia.org/wiki/Microsoft"
@pytest.mark.skipif(
skip_all,
reason="do not run if dependency is not installed",
)
def test_bing_markdown_search() -> None:
search_engine = BingMarkdownSearch()
results = search_engine.search(BING_QUERY)
assert BING_STRING in results
assert BING_EXPECTED_RESULT in results
@pytest.mark.skipif(
skip_api,
reason="skipping tests that require a Bing API key",
@ -41,5 +30,4 @@ def test_bing_markdown_search_api() -> None:
if __name__ == "__main__":
"""Runs this file's tests from the command line."""
test_bing_markdown_search()
test_bing_markdown_search_api()