Skip to content

Commit

Permalink
Use pytest xfail instead of commenting out test
Browse files Browse the repository at this point in the history
Signed-off-by: Merel Theisen <[email protected]>
  • Loading branch information
merelcht committed Dec 5, 2023
1 parent 04a039a commit 9c519cd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
29 changes: 15 additions & 14 deletions kedro-datasets/tests/dask/test_parquet_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,21 @@ def test_empty_credentials_load(self, bad_credentials):
with pytest.raises(DatasetError, match=pattern):
parquet_dataset.load().compute()

# def test_pass_credentials(self, mocker):
# """Test that AWS credentials are passed successfully into boto3
# client instantiation on creating S3 connection."""
# client_mock = mocker.patch("botocore.session.Session.create_client")
# s3_dataset = ParquetDataset(filepath=S3_PATH, credentials=AWS_CREDENTIALS)
# pattern = r"Failed while loading data from data set ParquetDataset\(.+\)"
# with pytest.raises(DatasetError, match=pattern):
# s3_dataset.load().compute()
#
# assert client_mock.call_count == 1
# args, kwargs = client_mock.call_args_list[0]
# assert args == ("s3",)
# assert kwargs["aws_access_key_id"] == AWS_CREDENTIALS["key"]
# assert kwargs["aws_secret_access_key"] == AWS_CREDENTIALS["secret"]
@pytest.mark.xfail
def test_pass_credentials(self, mocker):
"""Test that AWS credentials are passed successfully into boto3
client instantiation on creating S3 connection."""
client_mock = mocker.patch("botocore.session.Session.create_client")
s3_dataset = ParquetDataset(filepath=S3_PATH, credentials=AWS_CREDENTIALS)
pattern = r"Failed while loading data from data set ParquetDataset\(.+\)"
with pytest.raises(DatasetError, match=pattern):
s3_dataset.load().compute()

assert client_mock.call_count == 1
args, kwargs = client_mock.call_args_list[0]
assert args == ("s3",)
assert kwargs["aws_access_key_id"] == AWS_CREDENTIALS["key"]
assert kwargs["aws_secret_access_key"] == AWS_CREDENTIALS["secret"]

def test_save_data(self, s3_dataset, mocked_s3_bucket):
"""Test saving the data to S3."""
Expand Down
9 changes: 5 additions & 4 deletions kedro-datasets/tests/spark/test_spark_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,10 +730,11 @@ class TestSparkDatasetVersionedS3:
os.environ["AWS_ACCESS_KEY_ID"] = "FAKE_ACCESS_KEY"
os.environ["AWS_SECRET_ACCESS_KEY"] = "FAKE_SECRET_KEY"

# def test_no_version(self, versioned_dataset_s3):
# pattern = r"Did not find any versions for SparkDataset\(.+\)"
# with pytest.raises(DatasetError, match=pattern):
# versioned_dataset_s3.load()
@pytest.mark.xfail
def test_no_version(self, versioned_dataset_s3):
pattern = r"Did not find any versions for SparkDataset\(.+\)"
with pytest.raises(DatasetError, match=pattern):
versioned_dataset_s3.load()

def test_load_latest(self, mocker, versioned_dataset_s3):
get_spark = mocker.patch(
Expand Down

0 comments on commit 9c519cd

Please sign in to comment.