Skip to content

Conversation

@igobranco
Copy link
Member

This commit refactors the testing infrastructure to leverage edx-platform's test configuration instead of custom mock backends, improving test reliability and reducing maintenance overhead.

Key changes:

Test Infrastructure:

  • Configure pytest with 60-second timeout protection to prevent hanging tests
  • Add pytest-timeout plugin to requirements/test.in
  • Remove TOX dependency in favor of direct virtual environment usage

Makefile Enhancements:

  • Add automatic MongoDB Docker container management (mongo:7)
  • Implement virtual environment auto-creation and validation
  • Add Python 3.11 version checking with clear error messages
  • Create new test targets: test (auto-managed MongoDB) and test-keep-mongo
  • Add MongoDB lifecycle targets: mongo-start, mongo-stop, mongo-status, mongo-ping
  • Update test execution to run from edx-platform context with proper PYTHONPATH
  • Add coverage reporting with combine and include filters

Settings Refactoring:

  • Migrate from custom mock backends to edx-platform test settings
  • Remove deprecated NAU_*_MODULE override settings from nau_openedx_extensions/settings/test.py
  • Add MongoDB connection configuration for modulestore tests
  • Configure CONTENTSTORE and update_module_store_settings for Mongo integration
  • Remove test-specific settings from app configs (apps.py files)
  • Create separate test_settings.py for coursecertificate app if needed

GitHub Actions CI:

  • Add MongoDB version to test matrix for documentation
  • Add Docker verification step to ensure container support
  • Add 60-minute timeout to test execution
  • Update checkout and requirements steps to use proper working directories
  • Configure cache paths for both edx-platform and nau-openedx-extensions

Additional Improvements:

  • Add detailed logging to exception handlers in partner_integration views
  • Clean up code formatting and improve error messages
  • Add comprehensive Makefile help documentation

This migration enables:

  • Direct use of edx-platform factories and models in tests
  • Real MongoDB testing via Docker containers
  • Consistent test environment between local and CI
  • Reduced test maintenance by depending on edx-platform test infrastructure
  • Automatic timeout protection preventing indefinite test hangs

related to: fccn/nau-technical#674

@igobranco igobranco self-assigned this Nov 26, 2025
This commit refactors the testing infrastructure to leverage edx-platform's
test configuration instead of custom mock backends, improving test reliability
and reducing maintenance overhead.

Key changes:

Test Infrastructure:
- Configure pytest with 60-second timeout protection to prevent hanging tests
- Add pytest-timeout plugin to requirements/test.in
- Remove TOX dependency in favor of direct virtual environment usage

Makefile Enhancements:
- Add automatic MongoDB Docker container management (mongo:7)
- Implement virtual environment auto-creation and validation
- Add Python 3.11 version checking with clear error messages
- Create new test targets: `test` (auto-managed MongoDB) and `test-keep-mongo`
- Add MongoDB lifecycle targets: mongo-start, mongo-stop, mongo-status, mongo-ping
- Update test execution to run from edx-platform context with proper PYTHONPATH
- Add coverage reporting with combine and include filters

Settings Refactoring:
- Migrate from custom mock backends to edx-platform test settings
- Remove deprecated NAU_*_MODULE override settings from nau_openedx_extensions/settings/test.py
- Add MongoDB connection configuration for modulestore tests
- Configure CONTENTSTORE and update_module_store_settings for Mongo integration
- Remove test-specific settings from app configs (apps.py files)
- Create separate test_settings.py for coursecertificate app if needed

GitHub Actions CI:
- Add MongoDB version to test matrix for documentation
- Add Docker verification step to ensure container support
- Add 60-minute timeout to test execution
- Update checkout and requirements steps to use proper working directories
- Configure cache paths for both edx-platform and nau-openedx-extensions

Additional Improvements:
- Add detailed logging to exception handlers in partner_integration views
- Clean up code formatting and improve error messages
- Add comprehensive Makefile help documentation

This migration enables:
- Direct use of edx-platform factories and models in tests
- Real MongoDB testing via Docker containers
- Consistent test environment between local and CI
- Reduced test maintenance by depending on edx-platform test infrastructure
- Automatic timeout protection preventing indefinite test hangs

related to: fccn/nau-technical#674
@igobranco igobranco force-pushed the igobranco/issues/674/use-tests-configs-from-edx-platform branch from a93c36e to a81cc53 Compare November 26, 2025 22:43
@igobranco
Copy link
Member Author

@Tiago-Salles I already have squashed my last commits.

Copy link
Contributor

@Tiago-Salles Tiago-Salles left a comment

Choose a reason for hiding this comment

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

LGTM!

@Tiago-Salles Tiago-Salles merged commit 9287a35 into Tiago-Salles/issues/674-data-extraction-rest-service Nov 27, 2025
3 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.

3 participants