Skip to content

Unfail anomaly detection tests#252

Merged
sudsali merged 6 commits intoawslabs:masterfrom
nikie:unfail-anomaly-detection-tests
May 7, 2026
Merged

Unfail anomaly detection tests#252
sudsali merged 6 commits intoawslabs:masterfrom
nikie:unfail-anomaly-detection-tests

Conversation

@nikie
Copy link
Copy Markdown
Contributor

@nikie nikie commented Jun 6, 2025

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

Description of changes:

  • Unfail anomaly detection tests by removing pytest.mark.xfail marks and making tests pass, except for the test_anomalyDetector test which relates to a not implemented feature.
  • Add assertions to the test_RelativeRateOfChangeStrategy test.
  • Apply black formatting to anomaly detection 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_anomaly_detection.py
Comment thread tests/test_anomaly_detection.py
Comment thread tests/test_anomaly_detection.py
Comment thread tests/test_anomaly_detection.py
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

No issues found.


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

@nikie nikie force-pushed the unfail-anomaly-detection-tests branch from 8044c42 to 17c5fa1 Compare May 4, 2026 21:45
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

No issues found.


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

sudsali
sudsali previously approved these changes May 6, 2026
@sudsali sudsali dismissed their stale review May 6, 2026 21:24

Make sure all the Checks pass inorder for the PR to be merged.

@sudsali
Copy link
Copy Markdown
Contributor

sudsali commented May 6, 2026

@nikie Make sure all the checks pass for the PR to be merged.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

No issues found.


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

@nikie nikie force-pushed the unfail-anomaly-detection-tests branch from 64c2188 to 21c6cd0 Compare May 7, 2026 10:17
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: 1b0eaabe) — may not be fully accurate. Reply if this doesn't help.

Additional feedback:

tests/test_anomaly_detection.py:305 — The @pytest.mark.xfail condition os.environ.get("SPARK_VERSION") in ["3.1.3", "3.2"] will only match the exact string "3.2", but SPARK_VERSION is typically set to a full version like "3.2.0" or "3.2.1". The _extract_major_minor_versions in configs.py handles this for the library, but os.environ.get returns the raw string. You should use startswith or extract the major.minor version for comparison, e.g. os.environ.get("SPARK_VERSION", "").startswith("3.1") or os.environ.get("SPARK_VERSION", "").startswith("3.2").

Comment thread tests/test_anomaly_detection.py
Comment thread tests/test_anomaly_detection.py
@nikie nikie force-pushed the unfail-anomaly-detection-tests branch from 21c6cd0 to a3c1432 Compare May 7, 2026 10:19
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026


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

Inline feedback:

tests/test_anomaly_detection.py:295 — The xfail condition os.environ.get("SPARK_VERSION") in ["3.1.3", "3.2"] will not match versions like "3.2.0" or "3.2.1" because it does an exact string comparison. Consider using _get_spark_version() from pydeequ.configs (which extracts major.minor) or use startswith checks, e.g.:

os.environ.get("SPARK_VERSION", "").startswith(("3.1", "3.2"))

@nikie nikie force-pushed the unfail-anomaly-detection-tests branch from a3c1432 to 1b9fa8c Compare May 7, 2026 10:20
@nikie nikie force-pushed the unfail-anomaly-detection-tests branch from 1b9fa8c to b97513a Compare May 7, 2026 10:20
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

No issues found.


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

1 similar comment
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

No issues found.


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

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: 1b0eaabe) — may not be fully accurate. Reply if this doesn't help.

Additional feedback:

tests/test_anomaly_detection.py:295os.environ.get("SPARK_VERSION").startswith(("3.1", "3.2")) will raise AttributeError: 'NoneType' object has no attribute 'startswith' if the SPARK_VERSION environment variable is not set (since get returns None). Use os.environ.get("SPARK_VERSION", "").startswith(("3.1", "3.2")) to provide a default empty string.

Comment thread tests/test_anomaly_detection.py
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

No issues found.


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

@nikie
Copy link
Copy Markdown
Contributor Author

nikie commented May 7, 2026

@nikie Make sure all the checks pass for the PR to be merged.

Hi, @sudsali ,
The 2 failing tests tests/test_anomaly_detection.py::TestAnomalies::test_BatchNormalStrategy and test_holtWinters were previously marked with xfail as follows:

    # TODO - Failing bcoz of
    # can not implement breeze.stats.DescriptiveStats, because it is not an interface
    # (breeze.stats.DescriptiveStats is in unnamed module of loader 'app')
    @pytest.mark.xfail(reason="TODO: breeze.stats.DescriptiveStats is in unnamed module of loader 'app'")

I do not fully understand the reason, but apparently the tests succeed starting from Spark 3.3.
Deequ may have been fixed in a way that the anomaly detectors still do not work in Spark 3.1 and 3.2 in Python.

Since it is not possible to fix the original issue in python-deequ, I have returned xfail marks to the tests making them conditional to Spark 3.1 and 3.2 versions and removed "TODO" comment:

    @pytest.mark.xfail(
        os.environ.get("SPARK_VERSION", "").startswith(("3.1", "3.2")),
        reason=(
            "Not supported in Spark < 3.3: breeze.stats.DescriptiveStats "
            "is in unnamed module of loader 'app'"
        )
    )

I have tested locally for all Spark versions, used in the CI matrix: 3.1.3, 3.2, 3.3, 3.5.
The 2 affected tests xfail for Spark 3.1.3, 3.2 and succeed for 3.3 and 3.5.

If this is fine, could you, please trigger the test workflow?

@nikie nikie requested a review from sudsali May 7, 2026 10:55
@sudsali sudsali merged commit e210023 into awslabs:master May 7, 2026
6 checks passed
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.

2 participants