diff --git a/pyproject.toml b/pyproject.toml index 3ed29c68..891a2d85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,6 +91,7 @@ developer-test-command = "pytest -x -s -m 'not fuzz'" developer-test-silent-command = "pytest -x -m 'not fuzz' --show-capture=no" hypothesis-test-command = "pytest -x -s -m 'fuzz'" hypothesis-test-silent-command = "pytest -x -m 'fuzz' --show-capture=no" +not-openai-test = "pytest -x -s -m 'not api'" [tool.taskipy.tasks] all = "task black && task mypy && task ruff && task test" @@ -104,13 +105,14 @@ developer-test = { cmd = "{developer-test-command}", help = "Run developer-creat developer-test-silent = { cmd = "{developer-test-silent-command}", help = "Run developer-created without output", use_vars = true } hypothesis = { cmd = "{hypothesis-test-command}", help = "Run the hypothesis-based test cases", use_vars = true} hypothesis-silent = { cmd = "{hypothesis-test-silent-command}", help = "Run the hypothesis-based test cases", use_vars = true } -test = { cmd = "pytest -x -s -vv -n auto -k 'not test_createchecks'", help = "Run the pytest test suite using order randomization and test distribution excluding test_createchecks.py" } -test-not-randomly = { cmd = "pytest -x -s -vv -p no:randomly -k 'not test_createchecks'", help = "Run the pytest test suite without order randomization excluding test_createchecks.py" } -test-not-xdist = { cmd = "pytest -x -s -vv -p no:xdist -k 'not test_createchecks'", help = "Run the pytest test suite without order randomization excluding test_createchecks.py" } -test-silent = { cmd = "pytest -x --show-capture=no -n auto -k 'not test_createchecks'", help = "Run the pytest test suite without showing output excluding test_createchecks.py" } -test-silent-not-randomly = { cmd = "pytest -x --show-capture=no -p no:randomly -k 'not test_createchecks'", help = "Run the pytest test suite without showing output and order randomization excluding test_createchecks.py" } -test-silent-not-xdist = { cmd = "pytest -x --show-capture=no -p no:xdist -k 'not test_createchecks'", help = "Run the pytest test suite without showing output and test distribution excluding test_createchecks.py" } +test = { cmd = "pytest -x -s -vv -n auto", help = "Run the pytest test suite using order randomization and test distribution" } +test-not-randomly = { cmd = "pytest -x -s -vv -p no:randomly", help = "Run the pytest test suite without order randomization" } +test-not-xdist = { cmd = "pytest -x -s -vv -p no:xdist", help = "Run the pytest test suite without order randomization" } +test-silent = { cmd = "pytest -x --show-capture=no -n auto", help = "Run the pytest test suite without showing output" } +test-silent-not-randomly = { cmd = "pytest -x --show-capture=no -p no:randomly", help = "Run the pytest test suite without showing output and order randomization" } +test-silent-not-xdist = { cmd = "pytest -x --show-capture=no -p no:xdist", help = "Run the pytest test suite without showing output and test distribution" } test-api = {cmd = "pytest -x -s -vv -n auto || pytest -x -s -vv -n auto", help = "Run the test_createchecks.py file only when provided with an API key", use_vars = true } +openai-test = { cmd = "{not-openai-test}", help = "Run openai powered test cases", use_vars = true } test-coverage = { cmd = "{coverage-test-command}", help = "Run coverage monitoring for the test suite", use_vars = true } test-coverage-silent = { cmd = "{coverage-test-command-silent}", help = "Run coverage monitoring for tests without output", use_vars = true } diff --git a/pytest.ini b/pytest.ini index 00910c22..49c7cfe7 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,5 +1,6 @@ [pytest] markers = + api: test cases that use OpenAI API fuzz: test cases that use Hypothesis for input generation filterwarnings = ignore::DeprecationWarning diff --git a/tests/test_createchecks.py b/tests/test_createchecks.py index 374e9880..9a924fca 100644 --- a/tests/test_createchecks.py +++ b/tests/test_createchecks.py @@ -11,6 +11,7 @@ def get_valid_api_key(): return os.getenv("API_KEY") +@pytest.mark.api def test_valid_api_key(): """Test is_valid_api_key function with a valid api key.""" valid_api_key = get_valid_api_key() @@ -21,6 +22,7 @@ def test_valid_api_key(): assert result is True +@pytest.mark.api def test_invalid_api_key(): """Test is_valid_api_key function with an invalid api key.""" invalid_api_key = "fk-561sf56a1sf561as5f1asf165as1" @@ -28,6 +30,7 @@ def test_invalid_api_key(): assert result is False +@pytest.mark.api def test_generate_yaml_config(): valid_api_key = get_valid_api_key() test_genscript = "Write: 'Hello, World'"