Fix restored-case data file generation bug and introduce pytest-based backend test suite#30
Open
parthdagia05 wants to merge 1 commit intoOSeMOSYS:masterfrom
Open
Conversation
- Ensure res/<caserunname>/ directory is auto-created in generateDatafile() - Harden DataFileRoute error handling for filesystem failures - Add pytest-based backend test suite - Add regression test for restored-case bug - All tests passing (4 passed) This prevents FileNotFoundError when restored cases lack pre-generated data directories.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Fix: Restored Case Resiliency & Introduction of Backend Test Suite
Summary
This PR resolves a critical 500 Internal Server Error encountered during data file generation in restored models. Additionally, it establishes a foundational Pytest-based automated test suite, marking a shift toward production-grade reliability and regression protection for the MUIO backend.
Bug Fix: Restored Case Data File Generation
The Problem
When a model is backed up and restored, cases that have a run entry in
resData.jsonbut never had a data file generated are prone to failure.generateDatafile()attempted to write tores/<caserunname>/data.txtwithout verifying the existence of the parent directory.FileNotFoundError.The Fix
Implemented a defensive directory guard in
DataFileClass.generateDatafile():