Skip to content

Unfail repository tests#251

Open
nikie wants to merge 2 commits intoawslabs:masterfrom
nikie:unfail-repository-tests
Open

Unfail repository tests#251
nikie wants to merge 2 commits intoawslabs:masterfrom
nikie:unfail-repository-tests

Conversation

@nikie
Copy link
Copy Markdown

@nikie nikie commented Jun 6, 2025

Issue #, if available:
There are no user facing changes.

Description of changes:

  • Unfail repository tests by removing pytest.mark.xfail marks and asserting the failing statements with self.assertRaises.
  • Apply black formatting to repository tests.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Generated by AI (model: us.anthropic.claude-opus-4-6-v1, prompt: 8c93b14f) — may not be fully accurate. Reply if this doesn't help.

Comment thread tests/test_repository.py
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: from py4j.protocol import Py4JError is imported but pytest was removed. However, Py4JError is used in the test, so this is fine. Just noting that pytest removal is correct since pytest.mark.xfail is no longer used.

Comment thread tests/test_repository.py
.saveOrAppendResult(resultKey)
.run()
with self.assertRaises(Py4JError) as err:
_ = (
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test_fail_no_load test asserts the error message string exactly, but MetricsRepository._check_RepositoryLoader checks if not self.RepositoryLoader which would raise AttributeError only if RepositoryLoader was never set as an attribute. However, repository.before(...) calls self._check_RepositoryLoader() which accesses self.RepositoryLoader. Since RepositoryLoader is never initialized in __init__ of FileSystemMetricsRepository (or its parent MetricsRepository), this will raise AttributeError: 'FileSystemMetricsRepository' object has no attribute 'RepositoryLoader' — but this is an implementation detail that could change. The assertion is correct for the current code, but it's brittle. Consider using self.assertIn or just self.assertRaises(AttributeError) without checking the exact message.

Comment thread tests/test_repository.py
"""This test should fail because it doesn't call useRepository() before saveOrAppendResult()"""
"""This run fails because it doesn't call useRepository() before saveOrAppendResult()."""
metrics_file = FileSystemMetricsRepository.helper_metrics_file(self.spark, "metrics.json")
print(f"metrics filepath: {metrics_file}")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_fail_no_useRepository asserts a specific Py4J error message substring "Method saveOrAppendResult([class com.amazon.deequ.repository.ResultKey]) does not exist". This is fragile because the exact error message depends on the Py4J and Deequ JAR versions. If the Deequ version changes, this message could differ. Consider just asserting self.assertRaises(Py4JError) without checking the message content, or use a less specific substring like "saveOrAppendResult".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant