Skip to content

Commit

Permalink
skip tests if env var missing
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy committed Jun 25, 2024
1 parent 6a27b19 commit f1515e8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions glossary_resources/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest

from daras_ai.image_input import storage_blob_for
from daras_ai_v2 import settings
from daras_ai_v2.crypto import get_random_doc_id
from glossary_resources.models import GlossaryResource
from tests.test_translation import _test_run_google_translate_one
Expand Down Expand Up @@ -62,6 +63,7 @@ def glossary_url():
GlossaryResource.objects.all().delete()


@pytest.mark.skipif(not settings.GS_BUCKET_NAME, reason="No GCS bucket")
@pytest.mark.django_db
def test_run_google_translate_glossary(glossary_url, threadpool_subtest):
for text, expected, expected_with_glossary in TRANSLATION_TESTS_GLOSSARY:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from fastapi.testclient import TestClient

from app_users.models import AppUser
from daras_ai_v2 import settings
from daras_ai_v2.billing import create_stripe_checkout_session
from gooey_ui import RedirectException
from payments.plans import PricingPlan
Expand All @@ -10,6 +11,7 @@
client = TestClient(app)


@pytest.mark.skipif(not settings.STRIPE_ENDPOINT_SECRET, reason="No stripe secret")
@pytest.mark.parametrize("plan", PricingPlan)
def test_create_checkout_session(
plan: PricingPlan, transactional_db, force_authentication: AppUser
Expand Down
4 changes: 4 additions & 0 deletions tests/test_slack.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pytest
from decouple import config
from starlette.testclient import TestClient

Expand All @@ -12,6 +13,9 @@ def test_slack_safe_channel_name():
assert safe_channel_name("My, Awesome, Channel %") == "my-awesome-channel"


@pytest.mark.skipif(
not config("TEST_SLACK_TEAM_ID", None), reason="No test slack team id"
)
def test_slack_get_response_for_msg_id(transactional_db):
team_id = config("TEST_SLACK_TEAM_ID")
user_id = config("TEST_SLACK_USER_ID")
Expand Down

0 comments on commit f1515e8

Please sign in to comment.