summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>2023-05-29 04:59:23 -0700
committerGitHub <noreply@github.com>2023-05-29 07:59:23 -0400
commit577df6f4988306ddf2e59f90cb422f07fd64a9b8 (patch)
tree30c40bd9e476bac1ca51f8fc86e8f016bdbb8ca3
parent8790efbcfe67779309276c3d68d7533b2f802fa0 (diff)
downloadspack-577df6f4988306ddf2e59f90cb422f07fd64a9b8.tar.gz
spack-577df6f4988306ddf2e59f90cb422f07fd64a9b8.tar.bz2
spack-577df6f4988306ddf2e59f90cb422f07fd64a9b8.tar.xz
spack-577df6f4988306ddf2e59f90cb422f07fd64a9b8.zip
sqlite: convert to new stand-alone test process (#37722)
-rw-r--r--var/spack/repos/builtin/packages/sqlite/package.py51
1 files changed, 13 insertions, 38 deletions
diff --git a/var/spack/repos/builtin/packages/sqlite/package.py b/var/spack/repos/builtin/packages/sqlite/package.py
index 65107742f8..7000b7d389 100644
--- a/var/spack/repos/builtin/packages/sqlite/package.py
+++ b/var/spack/repos/builtin/packages/sqlite/package.py
@@ -220,53 +220,28 @@ class Sqlite(AutotoolsPackage):
)
install(libraryname, self.prefix.lib)
- def _test_example(self):
- """Ensure a sequence of commands on example db are successful."""
+ def test_example(self):
+ """check example table dump"""
test_data_dir = self.test_suite.current_test_data_dir
db_filename = test_data_dir.join("packages.db")
- exe = "sqlite3"
# Ensure the database only contains one table
- expected = "packages"
- reason = 'test: ensuring only table is "{0}"'.format(expected)
- self.run_test(
- exe,
- [db_filename, ".tables"],
- expected,
- installed=True,
- purpose=reason,
- skip_missing=False,
- )
+ sqlite3 = which(self.prefix.bin.sqlite3)
+ out = sqlite3(db_filename, ".tables", output=str.split, error=str.split)
+ assert "packages" in out
# Ensure the database dump matches expectations, where special
# characters are replaced with spaces in the expected and actual
# output to avoid pattern errors.
- reason = "test: checking dump output"
expected = get_escaped_text_output(test_data_dir.join("dump.out"))
- self.run_test(
- exe,
- [db_filename, ".dump"],
- expected,
- installed=True,
- purpose=reason,
- skip_missing=False,
- )
-
- def _test_version(self):
- """Perform version check on the installed package."""
- exe = "sqlite3"
- vers_str = str(self.spec.version)
-
- reason = "test: ensuring version of {0} is {1}".format(exe, vers_str)
- self.run_test(
- exe, "-version", vers_str, installed=True, purpose=reason, skip_missing=False
- )
+ out = sqlite3(db_filename, ".dump", output=str.split, error=str.split)
+ check_outputs(expected, out)
- def test(self):
- """Perform smoke tests on the installed package."""
- # Perform a simple version check
- self._test_version()
+ def test_version(self):
+ """ensure version is expected"""
+ vers_str = str(self.spec.version)
- # Run a sequence of operations
- self._test_example()
+ sqlite3 = which(self.prefix.bin.sqlite3)
+ out = sqlite3("-version", output=str.split, error=str.split)
+ assert vers_str in out