-
Notifications
You must be signed in to change notification settings - Fork 222
Fix #5401 - BCL measure update picks up subfolders like resources/__pycache__ or tests/.pytest_cache #5402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
```
/media/DataExt4/Software/Others/OpenStudio2/src/utilities/bcl/test/BCLMeasure_GTest.cpp:517: Failure
Expected equality of these values:
numFiles + addedFiles
Which is: 13
files.size()
Which is: 14
/media/DataExt4/Software/Others/OpenStudio2/src/utilities/bcl/test/BCLMeasure_GTest.cpp:587: Failure
Value of: std::equal(newXMLPaths.begin(), newXMLPaths.end(), expectedAfterNewFilesAbsolutePaths.begin(), expectedAfterNewFilesAbsolutePaths.end())
Actual: false
Expected: true
/media/DataExt4/Software/Others/OpenStudio2/src/utilities/bcl/test/BCLMeasure_GTest.cpp:598: Failure
Value of: paths.empty()
Actual: false
Expected: true
There are 1 extra files in the XML:
* docs/.hidden_folder/subfolder/file.txt
/media/DataExt4/Software/Others/OpenStudio2/src/utilities/bcl/test/BCLMeasure_GTest.cpp:703: Failure
Value of: std::equal(xmlFilePaths.begin(), xmlFilePaths.end(), expectedAfterNewFilesAbsolutePaths.begin(), expectedAfterNewFilesAbsolutePaths.end())
Actual: false
Expected: true
```
…able_recursion_pending
| for (auto it = openstudio::filesystem::recursive_directory_iterator(approvedSubFolderAbsolutePath); | ||
| it != openstudio::filesystem::recursive_directory_iterator(); ++it) { | ||
| const auto& absoluteFilePath = it->path(); | ||
|
|
||
| if (openstudio::filesystem::is_directory(absoluteFilePath)) { | ||
| const std::string name = absoluteFilePath.filename().string(); | ||
| if (!name.empty() && (name[0] == '.' || name == "__pycache__")) { | ||
| // Skip this directory and all its children | ||
| it.disable_recursion_pending(); | ||
| } | ||
| } else if (openstudio::filesystem::is_regular_file(absoluteFilePath)) { | ||
| if (!isApprovedFile(absoluteFilePath, m_directory)) { | ||
| continue; | ||
| } | ||
| const openstudio::path relativeFilePath = openstudio::filesystem::relative(absoluteFilePath, m_directory); | ||
| result |= addWithUsageTypeIfNotExisting(relativeFilePath, std::string(usageType)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a recursive_directory_iterator and use disable_recursion_pending to skip it and children if it's a hidden folder or named "pycache"
|
CI Results for d063960:
|
joseph-robertson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to generalize this a bit, and begin some sort of list of folder names to exclude? "pycache" would be the first entry in the list.
I actually thought the same thing! If we find another one, then we'll do it |
Pull request overview
Pull Request Author
Labels:
IDDChangeAPIChangePull Request - Ready for CIso that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.