diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2022-12-10 11:59:59 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2022-12-10 16:43:44 -0800 |
commit | aa3b6e598f8a504ee00c86cc3035482e642d2874 (patch) | |
tree | 59e227924fc94294a9e90a0ea165ac34a75f36fd /lib | |
parent | 8035eeb36d5068fcbae613e51dd13cb1ae9f4888 (diff) | |
download | spack-aa3b6e598f8a504ee00c86cc3035482e642d2874.tar.gz spack-aa3b6e598f8a504ee00c86cc3035482e642d2874.tar.bz2 spack-aa3b6e598f8a504ee00c86cc3035482e642d2874.tar.xz spack-aa3b6e598f8a504ee00c86cc3035482e642d2874.zip |
`pkg grep`: use `capfd` instead of executable for tests
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/test/cmd/pkg.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/spack/spack/test/cmd/pkg.py b/lib/spack/spack/test/cmd/pkg.py index 2f1a1a6f3a..3f0b89309b 100644 --- a/lib/spack/spack/test/cmd/pkg.py +++ b/lib/spack/spack/test/cmd/pkg.py @@ -297,19 +297,19 @@ def test_pkg_hash(mock_packages): @pytest.mark.skipif(not spack.cmd.pkg.get_grep(), reason="grep is not installed") -def test_pkg_grep(mock_packages, capsys): +def test_pkg_grep(mock_packages, capfd): # only splice-* mock packages have the string "splice" in them - with capsys.disabled(): - output = pkg("grep", "-l", "splice", output=str) - + pkg("grep", "-l", "splice", output=str) + output, _ = capfd.readouterr() assert output.strip() == "\n".join( spack.repo.path.get_pkg_class(name).module.__file__ for name in ["splice-a", "splice-h", "splice-t", "splice-vh", "splice-z"] ) # ensure that this string isn't fouhnd - output = pkg("grep", "abcdefghijklmnopqrstuvwxyz", output=str, fail_on_error=False) + pkg("grep", "abcdefghijklmnopqrstuvwxyz", output=str, fail_on_error=False) assert pkg.returncode == 1 + output, _ = capfd.readouterr() assert output.strip() == "" # ensure that we return > 1 for an error |