Make testing spack commands simpler (#4868)
Adds SpackCommand class allowing Spack commands to be easily in Python
Example usage:
from spack.main import SpackCommand
info = SpackCommand('info')
out, err = info('mpich')
print(info.returncode)
This allows easier testing of Spack commands.
Also:
* Simplify command tests
* Simplify mocking in command tests.
* Simplify module command test
* Simplify python command test
* Simplify uninstall command test
* Simplify url command test
* SpackCommand uses more compatible output redirection
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
|
||||
|
||||
class A(AutotoolsPackage):
|
||||
"""Simple package with no dependencies"""
|
||||
"""Simple package with one optional dependency"""
|
||||
|
||||
homepage = "http://www.example.com"
|
||||
url = "http://www.example.com/a-1.0.tar.gz"
|
||||
|
||||
@@ -41,4 +41,4 @@ class Libdwarf(Package):
|
||||
depends_on("libelf")
|
||||
|
||||
def install(self, spec, prefix):
|
||||
pass
|
||||
touch(prefix.libdwarf)
|
||||
|
||||
@@ -34,11 +34,4 @@ class Libelf(Package):
|
||||
version('0.8.10', '9db4d36c283d9790d8fa7df1f4d7b4d9')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
configure("--prefix=%s" % prefix,
|
||||
"--enable-shared",
|
||||
"--disable-dependency-tracking",
|
||||
"--disable-debug")
|
||||
make()
|
||||
|
||||
# The mkdir commands in libelf's intsall can fail in parallel
|
||||
make("install", parallel=False)
|
||||
touch(prefix.libelf)
|
||||
|
||||
Reference in New Issue
Block a user