Skip to content
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

Merged
merged 3 commits into from
Jul 30, 2021
Merged

Ninja and warnings in unit tests #62

merged 3 commits into from
Jul 30, 2021

Conversation

jmarrec
Copy link
Contributor

@jmarrec jmarrec commented Dec 2, 2020

@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.

Copy link
Contributor Author

@jmarrec jmarrec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +31 to +32
elif 'Ninja' in generator_name:
return KnownBuildTypes.Makefile
Copy link
Contributor Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +36 to +38
def test_detect_ninja(self):
self.add_cache_file('CMAKE_GENERATOR:INTERNAL=Ninja')
self.assertEqual(KnownBuildTypes.Makefile, autodetect_build_dir_type(self.build_dir))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test Detect ninja

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

Comment on lines +65 to +76
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
Copy link
Contributor Author

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

Copy link
Member

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.

Comment on lines +31 to +32
elif 'Ninja' in generator_name:
return KnownBuildTypes.Makefile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +36 to +38
def test_detect_ninja(self):
self.add_cache_file('CMAKE_GENERATOR:INTERNAL=Ninja')
self.assertEqual(KnownBuildTypes.Makefile, autodetect_build_dir_type(self.build_dir))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

Comment on lines +65 to +76
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
Copy link
Member

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.

@Myoldmopar
Copy link
Member

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 Myoldmopar merged commit e1b1afd into NREL:master Jul 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants