Skip to content

Commit

Permalink
skip s3 tests if the secrets are not available (#511)
Browse files Browse the repository at this point in the history
* skip s3 tests if the secrets are not available
  • Loading branch information
guenp authored Feb 11, 2025
1 parent 41ff762 commit 87540aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,14 @@ def skip_by_profile_type(profile_type, request):
def test_data_path():
test_dir = os.path.dirname(os.path.abspath(__file__))
return os.path.join(test_dir, "data")


def pytest_collection_modifyitems(config, items):
# Skip the S3 tests if the secrets are not available
if not (
os.getenv("S3_MD_ORG_KEY") and os.getenv("S3_MD_ORG_REGION") and os.getenv("S3_MD_ORG_SECRET")
):
skip_s3 = pytest.mark.skip(reason="need S3 credentials to run this test")
for item in items:
if "with_s3_creds" in item.keywords:
item.add_marker(skip_s3)
2 changes: 2 additions & 0 deletions tests/functional/adapter/test_external.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def empty(self):
return True


@pytest.mark.with_s3_creds
@pytest.mark.skip_profile("buenavista")
class TestExternalMaterializationsS3(BaseExternalMaterializations):
@pytest.fixture(scope="class")
Expand All @@ -213,6 +214,7 @@ def empty(self):
return False


@pytest.mark.with_s3_creds
@pytest.mark.skip_profile("buenavista")
class TestExternalMaterializationsS3Empty(BaseExternalMaterializations):
@pytest.fixture(scope="class")
Expand Down

0 comments on commit 87540aa

Please sign in to comment.