testing: use a tighter check if `bash` is available (#7520)
This fixes CI on Windows since GitHub Actions started installing WSL on their images which apparently installs some wrapper `bash` which does not run actual bash.
This commit is contained in:
parent
07ed197247
commit
41d211c24a
|
@ -1,7 +1,7 @@
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import shlex
|
import shlex
|
||||||
import shutil
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import py
|
import py
|
||||||
|
@ -288,8 +288,19 @@ class TestParser:
|
||||||
|
|
||||||
|
|
||||||
def test_argcomplete(testdir, monkeypatch) -> None:
|
def test_argcomplete(testdir, monkeypatch) -> None:
|
||||||
if not shutil.which("bash"):
|
try:
|
||||||
pytest.skip("bash not available")
|
bash_version = subprocess.run(
|
||||||
|
["bash", "--version"],
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
universal_newlines=True,
|
||||||
|
).stdout
|
||||||
|
except OSError:
|
||||||
|
pytest.skip("bash is not available")
|
||||||
|
if "GNU bash" not in bash_version:
|
||||||
|
# See #7518.
|
||||||
|
pytest.skip("not a real bash")
|
||||||
|
|
||||||
script = str(testdir.tmpdir.join("test_argcomplete"))
|
script = str(testdir.tmpdir.join("test_argcomplete"))
|
||||||
|
|
||||||
with open(str(script), "w") as fp:
|
with open(str(script), "w") as fp:
|
||||||
|
|
Loading…
Reference in New Issue