Fix FileNotFoundError in Constellations Generation Testing by Ensuring Parent Directories Exist #3
+8
−0
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.
Description
The StarPerf suite's XML and TLE Constellations Testing modules encounter a
FileNotFoundError
when attempting to create or access.h5
files within thedata/XML_constellation/
anddata/TLE_constellation/
directories. This issue predominantly arises after agit clone
operation, as Git does not track empty directories, resulting in the absence of these critical paths in the cloned repository structure.The primary cause of this issue is the nature of
git clone
operations where directories without files are not created in the cloned repository. As a result, the expected directory structure needed for file operations does not exist, causing runtime errors during constellation data generation.Log
Solution
Modified the
constellation_configuration
function to check and create thedata/XML_constellation/
anddata/TLE_constellation/
directories if it does not exist. This is achieved using theos.makedirs()
function with theexist_ok=True
parameter, ensuring idempotency.Testing
✅ Ensured existing unit tests pass with the proposed changes
✅ Manual testing performed post-
git clone
to validate the fix