From 26db3381776d8db6e914bd15b84c3d748c5fcd08 Mon Sep 17 00:00:00 2001 From: Jason Munro Date: Mon, 24 May 2021 11:51:32 -0700 Subject: [PATCH] Skip client tests if api key not in env --- tests/test_client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_client.py b/tests/test_client.py index 8a4a9d1b..41437dbc 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,5 +1,5 @@ import pytest -from mp_api.core.client import MPRestError +import os from mp_api.matproj import MPRester key_only_resters = { @@ -33,3 +33,7 @@ def test_generic_get_methods(rester): elif name not in special_resters: doc = rester.get_document_by_id(key_only_resters[name], fields=[rester.primary_key]) assert isinstance(doc, rester.document_model) + + +if os.environ.get("MP_API_KEY", None) is None: + pytest.mark.skip(test_generic_get_methods)