Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request adds support for tidal currents and EAC mooring array products to the oceancurrent file server API. The changes enable the system to handle new product types with specific directory structures and file patterns.
- Adds configuration for three new product types: tidalCurrents-spd, tidalCurrents-sl, and EACMooringArray
- Updates region extraction logic to handle new suffix patterns (_spd, _hv)
- Enhances test coverage with comprehensive test cases for the new products
- Improves test reliability by implementing order-independent JSON comparison
Reviewed Changes
Copilot reviewed 3 out of 15 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| oceancurrent_file_server_api.py | Adds new product configurations and region extraction logic for tidal currents and EAC mooring |
| test_oceancurrent_file_server_api.py | Adds test cases for new products and improves JSON comparison methodology |
| test_argo_oceancurrent.py | Adds sorting for consistent test comparison |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| # Use local test data if DEV_MODE environment variable is set | ||
| base_path = "/mnt/oceancurrent/website/" | ||
| if os.getenv("DEV_MODE") == "true": | ||
| OCEAN_CURRENT_FILE_ROOT_PATH = f"./ARGO/oceancurrent/tests{base_path}" |
There was a problem hiding this comment.
The DEV_MODE feature introduces a hardcoded relative path that may not work reliably across different execution contexts. Consider using an absolute path or making the test data location configurable through an environment variable to improve maintainability.
| OCEAN_CURRENT_FILE_ROOT_PATH = f"./ARGO/oceancurrent/tests{base_path}" | |
| test_data_path = os.getenv("OCEAN_CURRENT_TEST_DATA_PATH") | |
| if test_data_path: | |
| OCEAN_CURRENT_FILE_ROOT_PATH = os.path.join(test_data_path, base_path.lstrip("/")) | |
| else: | |
| # Use absolute path relative to this file for test data | |
| OCEAN_CURRENT_FILE_ROOT_PATH = str((Path(__file__).parent / "tests" / base_path.lstrip("/")).resolve()) |
Updated test files to sort both expected and generated JSON data before comparison to avoid test failures due to unpredictable file system ordering.
1752373 to
84116ea
Compare
No description provided.