|
22 | 22 | from types import SimpleNamespace |
23 | 23 |
|
24 | 24 | import pytest |
25 | | -from testcontainers.core import waiting_utils |
26 | 25 |
|
27 | 26 | from apache_beam.options import pipeline_options |
28 | 27 | from apache_beam.testing.test_pipeline import TestPipeline |
@@ -162,12 +161,16 @@ def pytest_configure(config): |
162 | 161 | """ |
163 | 162 | # for the entire test session. |
164 | 163 | print("\n--- Applying global testcontainers timeout configuration ---") |
165 | | - waiting_utils.config = SimpleNamespace( |
166 | | - timeout=int(os.getenv("TC_TIMEOUT", "120")), |
167 | | - max_tries=int(os.getenv("TC_MAX_TRIES", "120")), |
168 | | - sleep_time=float(os.getenv("TC_SLEEP_TIME", "1")), |
169 | | - ) |
170 | | - print("Successfully set waiting utils config") |
| 164 | + try: |
| 165 | + from testcontainers.core import waiting_utils |
| 166 | + waiting_utils.config = SimpleNamespace( |
| 167 | + timeout=int(os.getenv("TC_TIMEOUT", "120")), |
| 168 | + max_tries=int(os.getenv("TC_MAX_TRIES", "120")), |
| 169 | + sleep_time=float(os.getenv("TC_SLEEP_TIME", "1")), |
| 170 | + ) |
| 171 | + print("Successfully set waiting utils config") |
| 172 | + except ModuleNotFoundError: |
| 173 | + print("The testcontainers library is not installed.") |
171 | 174 |
|
172 | 175 | TestPipeline.pytest_test_pipeline_options = config.getoption( |
173 | 176 | 'test_pipeline_options', default='') |
|
0 commit comments