summaryrefslogtreecommitdiff
path: root/NOTICE
diff options
context:
space:
mode:
authorChris Green <greenc@fnal.gov>2020-04-29 20:18:48 -0500
committerGitHub <noreply@github.com>2020-04-29 18:18:48 -0700
commit9698907e741a90e921b5b59e6db9ab80cb459006 (patch)
tree54f1d6a23ad30aef477d7f3e8351bad9200640ba /NOTICE
parentd12e588c60cb98382c3f6907492fbb220e50d62d (diff)
downloadspack-9698907e741a90e921b5b59e6db9ab80cb459006.tar.gz
spack-9698907e741a90e921b5b59e6db9ab80cb459006.tar.bz2
spack-9698907e741a90e921b5b59e6db9ab80cb459006.tar.xz
spack-9698907e741a90e921b5b59e6db9ab80cb459006.zip
Spack command extensions: error-handling (#13635)
Generally speaking, errors that are encountered when attempting to load command extensions now terminate the running Spack instance. * Added new exceptions `spack.cmd.PythonNameError` and `spack.cmd.CommandNameError`. * New functions `spack.cmd.require_python_name(pname)` and `spack.cmd.require_cmd_name(cname)` check that `pname` and `cname` respectively meet requirements, throwing the appropriate error if not. * `spack.cmd.get_module()` uses `require_cmd_name()` and passes through exceptions from module load attempts. * `spack.cmd.get_command()` uses `require_cmd_name()` and invokes `get_module()` with the correct command-name form rather than the previous (incorrect) Python name. * Added New exceptions `spack.extensions.CommandNotFoundError` and `spack.extensions.ExtensionNamingError`. * `_extension_regexp` has a new leading underscore to indicate expected privacy. * `spack.extensions.extension_name()` raises an `ExtensionNamingError` rather than using `tty.warn()`. * `spack.extensions.load_command_extension()` checks command source existence early and bails out if missing. Also, exceptions raised by `load_module_from_file()` are passed through. * `spack.extensions.get_module()` raises `CommandNotFoundError` as appropriate. * Spack `main()` allows `parser.add_command()` exceptions to cause program end. Tests: * More common boilerplate has been pulled out into fixtures including `sys.modules` dictionary cleanup and resource-managed creation of a simple command extension with specified contents in the source file for a single named command. * "Hello, World!" test now uses a command named `hello-world` instead of `hello` in order to verify correct handling of commands with hyphens. * New tests for: * Missing (or misnamed) command. * Badly-named extension. * Verification that errors encountered during import of a command are propagated upward. Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
Diffstat (limited to 'NOTICE')
0 files changed, 0 insertions, 0 deletions