I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w
install .whl file in </install/prefix>
run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
Here is pytest output:
```console
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-argcomplete-2.0.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-argcomplete-2.0.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra test/test.py
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/argcomplete-2.0.0
collected 148 items
test/test.py FFFFFFFFF...FFF.FFFFFFFFFFF..FFFFF......x.........FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.x..xx..x........x.F....xs.......s....... [100%]
================================================================================= FAILURES =================================================================================
__________________________________________________________________ TestArgcomplete.test_action_activation __________________________________________________________________
self =
parser = MonkeyPatchedIntrospectiveArgumentParser(prog='pytest', usage=None, description=None, formatter_class=, conflict_handler='error', add_help=True)
command = 'prog bus ', point = '9', completer = , kwargs = {}
t = <_io.TextIOWrapper name=9 mode='w+' encoding='UTF-8'>, cm =
def run_completer(self, parser, command, point=None, completer=autocomplete, **kwargs):
if point is None:
point = str(len(command))
with TemporaryFile(mode="w+") as t:
os.environ["COMP_LINE"] = command
os.environ["COMP_POINT"] = point
with self.assertRaises(SystemExit) as cm:
> completer(parser, output_stream=t, exit_method=sys.exit, **kwargs)
test/test.py:80:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def __call__(self, argument_parser, always_complete_options=True, exit_method=os._exit, output_stream=None,
exclude=None, validator=None, print_suppressed=False, append_space=None,
default_completer=FilesCompleter()):
"""
:param argument_parser: The argument parser to autocomplete on
:type argument_parser: :class:`argparse.ArgumentParser`
:param always_complete_options:
Controls the autocompletion of option strings if an option string opening character (normally ``-``) has not
been entered. If ``True`` (default), both short (``-x``) and long (``--x``) option strings will be
suggested. If ``False``, no option strings will be suggested. If ``long``, long options and short options
with no long variant will be suggested. If ``short``, short options and long options with no short variant
will be suggested.
:type always_complete_options: boolean or string
:param exit_method:
Method used to stop the program after printing completions. Defaults to :meth:`os._exit`. If you want to
perform a normal exit that calls exit handlers, use :meth:`sys.exit`.
:type exit_method: callable
:param exclude: List of strings representing options to be omitted from autocompletion
:type exclude: iterable
:param validator:
Function to filter all completions through before returning (called with two string arguments, completion
and prefix; return value is evaluated as a boolean)
:type validator: callable
:param print_suppressed:
Whether or not to autocomplete options that have the ``help=argparse.SUPPRESS`` keyword argument set.
:type print_suppressed: boolean
:param append_space:
Whether to append a space to unique matches. The default is ``True``.
:type append_space: boolean
.. note::
If you are not subclassing CompletionFinder to override its behaviors,
use ``argcomplete.autocomplete()`` directly. It has the same signature as this method.
Produces tab completions for ``argument_parser``. See module docs for more info.
Argcomplete only executes actions if their class is known not to have side effects. Custom action classes can be
added to argcomplete.safe_actions, if their values are wanted in the ``parsed_args`` completer argument, or
their execution is otherwise desirable.
"""
self.__init__(argument_parser, always_complete_options=always_complete_options, exclude=exclude,
validator=validator, print_suppressed=print_suppressed, append_space=append_space,
default_completer=default_completer)
if "_ARGCOMPLETE" not in os.environ:
# not an argument completion invocation
return
global debug_stream
try:
debug_stream = os.fdopen(9, "w")
except Exception:
debug_stream = sys.stderr
debug()
if output_stream is None:
filename = os.environ.get("_ARGCOMPLETE_STDOUT_FILENAME")
if filename is not None:
debug("Using output file {}".format(filename))
output_stream = open(filename, "w")
if output_stream is None:
try:
output_stream = os.fdopen(8, "w")
except Exception:
debug("Unable to open fd 8 for writing, quitting")
exit_method(1)
# print("", stream=debug_stream)
# for v in "COMP_CWORD COMP_LINE COMP_POINT COMP_TYPE COMP_KEY _ARGCOMPLETE_COMP_WORDBREAKS COMP_WORDS".split():
# print(v, os.environ[v], stream=debug_stream)
ifs = os.environ.get("_ARGCOMPLETE_IFS", "\013")
if len(ifs) != 1:
debug("Invalid value for IFS, quitting [{v}]".format(v=ifs))
exit_method(1)
dfs = os.environ.get("_ARGCOMPLETE_DFS")
if dfs and len(dfs) != 1:
debug("Invalid value for DFS, quitting [{v}]".format(v=dfs))
exit_method(1)
comp_line = os.environ["COMP_LINE"]
comp_point = int(os.environ["COMP_POINT"])
cword_prequote, cword_prefix, cword_suffix, comp_words, last_wordbreak_pos = split_line(comp_line, comp_point)
# _ARGCOMPLETE is set by the shell script to tell us where comp_words
# should start, based on what we're completing.
# 1: Githubissues.
Githubissues is a development platform for aggregating issues.
I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w
Here is pytest output: