-
Notifications
You must be signed in to change notification settings - Fork 11
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
Ninja and warnings in unit tests #62
Conversation
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.
elif 'Ninja' in generator_name: | ||
return KnownBuildTypes.Makefile |
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.
Treat Ninja as Unix makefiles
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.
👍
def test_detect_ninja(self): | ||
self.add_cache_file('CMAKE_GENERATOR:INTERNAL=Ninja') | ||
self.assertEqual(KnownBuildTypes.Makefile, autodetect_build_dir_type(self.build_dir)) |
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.
test Detect ninja
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.
Nice.
with open(os.path.join(temp_idf_dir, 'file1.idf'), 'w') as f: | ||
f.write('hi') | ||
with open(os.path.join(temp_idf_dir, 'file2.iQQ'), 'w') as f: | ||
f.write('he') | ||
with open(os.path.join(temp_idf_dir, 'file3.idf'), 'w') as f: | ||
f.write('ha') | ||
with open(os.path.join(temp_idf_dir, 'file4.imf'), 'w') as f: | ||
f.write('ha') # macro | ||
with open(os.path.join(temp_idf_dir, '_ExternalInterface-actuator.idf'), 'w') as f: | ||
f.write('ha') # ext interface as FMU | ||
with open(os.path.join(temp_idf_dir, 'HVAC3ZoneGeometry.imf'), 'w') as f: | ||
f.write('ha') # macro resource file |
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.
Avoid warning when running unittests ResourceWarning: unclosed file <_io.TextIOWrapper
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.
I guess could've appended .close() on each of the lines, but this is good.
elif 'Ninja' in generator_name: | ||
return KnownBuildTypes.Makefile |
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.
👍
def test_detect_ninja(self): | ||
self.add_cache_file('CMAKE_GENERATOR:INTERNAL=Ninja') | ||
self.assertEqual(KnownBuildTypes.Makefile, autodetect_build_dir_type(self.build_dir)) |
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.
Nice.
with open(os.path.join(temp_idf_dir, 'file1.idf'), 'w') as f: | ||
f.write('hi') | ||
with open(os.path.join(temp_idf_dir, 'file2.iQQ'), 'w') as f: | ||
f.write('he') | ||
with open(os.path.join(temp_idf_dir, 'file3.idf'), 'w') as f: | ||
f.write('ha') | ||
with open(os.path.join(temp_idf_dir, 'file4.imf'), 'w') as f: | ||
f.write('ha') # macro | ||
with open(os.path.join(temp_idf_dir, '_ExternalInterface-actuator.idf'), 'w') as f: | ||
f.write('ha') # ext interface as FMU | ||
with open(os.path.join(temp_idf_dir, 'HVAC3ZoneGeometry.imf'), 'w') as f: | ||
f.write('ha') # macro resource file |
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.
I guess could've appended .close() on each of the lines, but this is good.
Merging this little thing in, sorry it took so long to context switch over to this, now quick I gotta go back to other work! |
@Myoldmopar
FOr some reason, these changes work in the unit test, but the GUI doesn't seem to register them. (I installed it by going to the root of the repo and typing
pip install -e .[dev,test]
)Edit: Nevermind. I was selecting the build folder then clicking OK, I realize now that I needed to actually double click the build folder to enter it before clicking ok. The changes are still needed though.