mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Tests: limit live API integration tests in Travis runs
To conserve our ESP test accounts' send quotas, don't run the live API integration tests 13 times in every Travis run. Instead, just run them twice, on a representative set of Python/Django combinations: * Once on Python 2.7 (currently with Django 1.8) * Once on Python 3.x (currently 3.5 with Django 1.9) (Prep for running weekly tests on Travis cron.) The *non*-integration tests still run on all combos. * Introduce RUN_LIVE_TESTS environment var to control whether live API integration test cases should run. Default True, except in Travis-CI runs default False. * Enable RUN_LIVE_TESTS in .travis.yml matrix for the Python/Django combos listed above.
This commit is contained in:
@@ -11,7 +11,7 @@ from django.test.utils import override_settings
|
||||
from anymail.exceptions import AnymailAPIError
|
||||
from anymail.message import AnymailMessage
|
||||
|
||||
from .utils import AnymailTestMixin, sample_image_path
|
||||
from .utils import AnymailTestMixin, sample_image_path, RUN_LIVE_TESTS
|
||||
|
||||
# For API_KEY auth tests:
|
||||
SENDGRID_TEST_API_KEY = os.getenv('SENDGRID_TEST_API_KEY')
|
||||
@@ -21,6 +21,7 @@ SENDGRID_TEST_USERNAME = os.getenv('SENDGRID_TEST_USERNAME')
|
||||
SENDGRID_TEST_PASSWORD = os.getenv('SENDGRID_TEST_PASSWORD')
|
||||
|
||||
|
||||
@unittest.skipUnless(RUN_LIVE_TESTS, "RUN_LIVE_TESTS disabled in this environment")
|
||||
@unittest.skipUnless(SENDGRID_TEST_API_KEY,
|
||||
"Set SENDGRID_TEST_API_KEY environment variable "
|
||||
"to run SendGrid integration tests")
|
||||
@@ -118,6 +119,7 @@ class SendGridBackendIntegrationTests(SimpleTestCase, AnymailTestMixin):
|
||||
self.assertIn("authorization grant is invalid", str(err))
|
||||
|
||||
|
||||
@unittest.skipUnless(RUN_LIVE_TESTS, "RUN_LIVE_TESTS disabled in this environment")
|
||||
@unittest.skipUnless(SENDGRID_TEST_USERNAME and SENDGRID_TEST_PASSWORD,
|
||||
"Set SENDGRID_TEST_USERNAME and SENDGRID_TEST_PASSWORD"
|
||||
"environment variables to run SendGrid integration tests")
|
||||
|
||||
Reference in New Issue
Block a user