Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions testing/test_parseopt.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import argparse
import os
import shlex
import shutil
import subprocess
import sys

import py
Expand Down Expand Up @@ -288,8 +288,19 @@ def test_multiple_metavar_help(self, parser: parseopt.Parser) -> None:


def test_argcomplete(testdir, monkeypatch) -> None:
if not shutil.which("bash"):
pytest.skip("bash not available")
try:
bash_version = subprocess.run(
["bash", "--version"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
Copy link
Member

@graingert graingert Jul 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you only look at the .stdout, so I think it's cleaner with stderr=subprocess.DEVNULL ?

universal_newlines=True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check=True here?

).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"))

with open(str(script), "w") as fp:
Expand Down