Conversation
- Added pytest-bdd and responses as dev dependencies - Created BDD test structure with 78 scenarios across 7 feature areas: - Items (15): CRUD operations and search - Collections (10): CRUD and listing - Storage (13): Upload, download, delete - Projects (13): Project item management - Authentication (12): M2M auth, token refresh, hooks - Error handling (9): Exception types and formats - Validation (10): Date, license, parameter validation - Added dedicated BDD test job to CI pipeline - All tests use mock server approach (responses library)
- Updated mock_config fixture to explicitly set URL configurations (test.app.open-cosmos.com) instead of relying on config.yaml - Fixed preauthenticated session test to use mock_config fixture - Ensures tests pass in CI where config.yaml is not present
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive BDD (Behavior-Driven Development) test coverage to the DataCosmos SDK using pytest-bdd and the responses library for HTTP mocking. The tests are organized into 7 feature areas with 78 scenarios that cover CRUD operations, authentication, error handling, validation, and storage operations. The implementation follows a mock-first approach without integration tests, using the responses library to mock all HTTP interactions.
Changes:
- Added pytest-bdd (>=7.0.0) and responses (>=0.25.0) as development dependencies
- Created 7 feature files with 78 BDD scenarios covering items, collections, storage, projects, authentication, error handling, and validation
- Implemented step definitions for all scenarios with shared fixtures and mocking infrastructure
- Updated CI pipeline with a dedicated BDD test job that runs independently from unit tests
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 35 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Updated lock file with new dev dependencies (pytest-bdd, responses) and dependency version changes |
| pyproject.toml | Added pytest-bdd and responses to dev dependencies; configured pytest markers and BDD features directory |
| .github/workflows/main.yaml | Split test job into separate "unit tests" and "BDD tests" jobs; updated test paths and job dependencies |
| tests/bdd/conftest.py | Shared fixtures for BDD tests including mock responses, client configuration, and test data generators |
| tests/bdd/step_defs/init.py | Package initialization file for step definitions |
| tests/bdd/step_defs/conftest.py | Step-level configuration file with unused imports |
| tests/bdd/step_defs/test_*.py | Step definition implementations for each feature area (items, collections, storage, projects, authentication, error_handling, validation) |
| tests/bdd/features/*.feature | Gherkin feature files defining BDD scenarios for all 7 feature areas |
| tests/bdd/init.py | Package initialization file for BDD tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Remove unused imports (pytest, ScenarioContext) from step files - Add shutil.rmtree cleanup for temp directories via pytest finalizer - Use getattr(context, 'exception', None) for safer exception checks - Fix DatacosmosError constructor (use setattr for status_code) - Consolidate verify_datacosmos_error and verify_value_error steps in conftest - Remove trailing whitespace from items.feature
- Remove unused imports (json, pytest, parsers, ScenarioContext) - Delete empty tests/bdd/step_defs/conftest.py - Improve ScenarioContext type hints - Move shared 'a configured STAC client' step to conftest.py - Replace tempfile.mkdtemp() with tmp_path fixture - Update pytest-bdd and responses version constraints - Update CI workflow to include tests/test_pass.py - Remove accidentally committed files: k8s-test/, datacosmos-sdk.code-workspace, test_project_ops.py
pepjo
left a comment
There was a problem hiding this comment.
I've only reviewed the BDD tests, they look good to me :)
No description provided.