Skip to content

FIX ModuleNotFoundError in Azure SQL memory integration test - #2130

Merged
behnam-o merged 1 commit into
microsoft:mainfrom
behnam-o:fix-failing-integration-tests
Jul 7, 2026
Merged

FIX ModuleNotFoundError in Azure SQL memory integration test#2130
behnam-o merged 1 commit into
microsoft:mainfrom
behnam-o:fix-failing-integration-tests

Conversation

@behnam-o

@behnam-o behnam-o commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

test_azure_sql_memory_integration.py imported make_scenario_result from unit.mocks, which is only importable during unit-test collection (where pytest's --import-mode=importlib puts tests/ on sys.path via the unit conftest.py/__init__.py chain). Under the integration suite that path isn't established, so every test in the file failed at collection with:

ModuleNotFoundError: No module named 'unit'

Fix

Made the file self-contained instead of reaching across test tiers:

  • Removed from unit.mocks import make_scenario_result.
  • Added ScenarioIdentifier / ScenarioResult to the existing pyrit.models import.
  • Added a local make_scenario_result helper that points class_module at the integration module.

This matches the file's existing pattern (get_test_scorer_identifier, get_test_atomic_attack_identifier) and keeps the integration suite independent of the unit tree.

Testing

All 7 tests in the file now collect cleanly.

@jsong468 jsong468 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for fixing! I wonder in the future if we want something like a shared_mocks.py module for both unit and integration test use in the parent tests/ directory?

@behnam-o
behnam-o added this pull request to the merge queue Jul 7, 2026
Merged via the queue into microsoft:main with commit 0594f68 Jul 7, 2026
47 checks passed
@behnam-o
behnam-o deleted the fix-failing-integration-tests branch July 7, 2026 19:53
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.

3 participants