From 99acf05024f6dc45c421cd1c1dab4aff4c5a808d Mon Sep 17 00:00:00 2001 From: Nick Sullivan Date: Tue, 20 Jun 2023 16:43:41 -0700 Subject: [PATCH] Skip joke test if the api key isn't set --- test_cli.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test_cli.py b/test_cli.py index cdb33b7..0e7833e 100644 --- a/test_cli.py +++ b/test_cli.py @@ -1,6 +1,7 @@ from cli import joke, version from click.testing import CliRunner from setup import __version__ +import os, pytest def test_version(): @@ -10,6 +11,7 @@ def test_version(): assert __version__ in result.output +@pytest.mark.skipif(os.getenv("OPENAI_API_KEY") is None, reason="Skipping live tests without an API key.") def test_joke(): runner = CliRunner() result = runner.invoke(joke)