Automatically detect import_modules in PythonPackage#15370
Automatically detect import_modules in PythonPackage#15370adamjstewart wants to merge 5 commits intospack:developfrom
Conversation
|
|
||
| def build_scripts_args(self, spec, prefix): | ||
| """Arguments to pass to build_scripts.""" | ||
| return [] |
There was a problem hiding this comment.
This little function has been missing since I first created PythonPackage. Oops...
| return | ||
|
|
||
| for name in self.build_time_test_callbacks: | ||
| try: |
There was a problem hiding this comment.
This try-except was masking a bug in my code that I didn't discover until after I removed it. Personally, I think we shouldn't be catching the exception, and raise an error if a non-existent test function is requested. For most build systems, we implement an empty test method with pass anyway, so it shouldn't fail.
| module = module[:-7] | ||
|
|
||
| # Python imports either use foo.bar or foo_bar, never foo-bar. | ||
| module = module.replace('-', '.') |
There was a problem hiding this comment.
|
@adamjstewart how close is this to being ready? |
|
I'm waiting for #15702 to be merged before finishing this PR. That will make it much easier to test without having to reinstall everything. |
|
Ok, then I will move this to the same release I have #15702 scheduled for |
Previously, users were required to override
import_modulesfor every PythonPackage that they wanted import tests for. Now, we automatically locate module files and packages. Users can still overrideimport_modulesfor weird cases.import_modulesimport_modulesfrom packagesNote that these
import_module_tests now exist for all 850+ PythonPackages in Spack, and these tests can be run after installation has already finished, making these great smoke tests for existing Spack installations.