Skip to content

Commit

Permalink
test: Added conditional skip
Browse files Browse the repository at this point in the history
  • Loading branch information
asafgardin committed Dec 12, 2023
1 parent 11f45f7 commit 67039a0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 9 additions & 0 deletions tests/integration_tests/skip_helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import os


def should_skip_bedrock_integration_tests() -> bool:
return os.getenv("AWS_ACCESS_KEY_ID") is None and os.getenv("AWS_SECRET_ACCESS_KEY") is None


def should_skip_studio_integration_tests() -> bool:
return os.getenv("AI21_API_KEY") is None
6 changes: 4 additions & 2 deletions tests/integration_tests/test_bedrock.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
"""
Run this script after setting the environment variable called AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
"""

import subprocess
from pathlib import Path

import pytest
import subprocess

from tests.integration_tests.skip_helpers import should_skip_bedrock_integration_tests

BEDROCK_DIR = "bedrock"


BEDROCK_PATH = Path(__file__).parent.parent.parent / "examples" / BEDROCK_DIR


@pytest.mark.skipif(should_skip_bedrock_integration_tests(), reason="No keys supplied for AWS. Skipping.")
@pytest.mark.parametrize(
argnames=["test_file_name"],
argvalues=[
Expand Down
3 changes: 3 additions & 0 deletions tests/integration_tests/test_studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
import pytest
import subprocess

from tests.integration_tests.skip_helpers import should_skip_studio_integration_tests

STUDIO_PATH = Path(__file__).parent.parent.parent / "examples" / "studio"


@pytest.mark.skipif(should_skip_studio_integration_tests(), reason="No key supplied for AI21 Studio. Skipping.")
@pytest.mark.parametrize(
argnames=["test_file_name"],
argvalues=[
Expand Down

0 comments on commit 67039a0

Please sign in to comment.