<86>Aug 3 07:16:08 userdel[2527821]: delete user 'rooter' <86>Aug 3 07:16:08 userdel[2527821]: removed group 'rooter' owned by 'rooter' <86>Aug 3 07:16:08 userdel[2527821]: removed shadow group 'rooter' owned by 'rooter' <86>Aug 3 07:16:08 groupadd[2527854]: group added to /etc/group: name=rooter, GID=1802 <86>Aug 3 07:16:08 groupadd[2527854]: group added to /etc/gshadow: name=rooter <86>Aug 3 07:16:08 groupadd[2527854]: new group: name=rooter, GID=1802 <86>Aug 3 07:16:08 useradd[2527877]: new user: name=rooter, UID=1802, GID=1802, home=/root, shell=/bin/bash, from=none <86>Aug 3 07:16:08 userdel[2527919]: delete user 'builder' <86>Aug 3 07:16:08 userdel[2527919]: removed group 'builder' owned by 'builder' <86>Aug 3 07:16:08 userdel[2527919]: removed shadow group 'builder' owned by 'builder' <86>Aug 3 07:16:08 groupadd[2527955]: group added to /etc/group: name=builder, GID=1803 <86>Aug 3 07:16:08 groupadd[2527955]: group added to /etc/gshadow: name=builder <86>Aug 3 07:16:08 groupadd[2527955]: new group: name=builder, GID=1803 <86>Aug 3 07:16:08 useradd[2527990]: new user: name=builder, UID=1803, GID=1803, home=/usr/src, shell=/bin/bash, from=none <13>Aug 3 07:16:11 rpmi: rpm-build-compat-2.4.9-alt1 sisyphus+385024.100.1.1 1747938414 installed <13>Aug 3 07:16:11 rpmi: libmpdec3-2.5.1-alt3 sisyphus+314490.500.5.1 1675432004 installed <13>Aug 3 07:16:11 rpmi: libgdbm-1.8.3-alt10 sisyphus+346222.200.3.2 1716468404 installed <13>Aug 3 07:16:11 rpmi: libexpat-2.7.1-alt1 sisyphus+379929.100.1.1 1743519381 installed <13>Aug 3 07:16:11 rpmi: openssl-config-3.2.0-alt1 sisyphus+366659.140.4.1 1736956949 installed <13>Aug 3 07:16:11 rpmi: libb2-0.98.1-alt1_1 sisyphus+291614.100.1.1 1638962877 installed <13>Aug 3 07:16:11 rpmi: libp11-kit-1:0.25.5-alt1 sisyphus+352553.100.1.1 1720622573 installed <13>Aug 3 07:16:11 rpmi: libtasn1-4.20.0-alt2 sisyphus+375829.100.1.1 1740299335 installed <13>Aug 3 07:16:11 rpmi: rpm-macros-alternatives-0.5.3-alt1 sisyphus+371878.100.1.1 1737988822 installed <13>Aug 3 07:16:11 rpmi: alternatives-0.5.3-alt1 sisyphus+371878.100.1.1 1737988822 installed <13>Aug 3 07:16:11 rpmi: ca-certificates-2025.07.29-alt1 sisyphus+391139.200.2.1 1753801312 installed <13>Aug 3 07:16:11 rpmi: ca-trust-0.2.0-alt1 sisyphus+344843.100.1.1 1712743326 installed <13>Aug 3 07:16:11 rpmi: p11-kit-trust-1:0.25.5-alt1 sisyphus+352553.100.1.1 1720622573 installed <13>Aug 3 07:16:11 rpmi: libcrypto3-3.3.3-alt1 sisyphus+374381.40.2.1 1739299401 installed <13>Aug 3 07:16:11 rpmi: libssl3-3.3.3-alt1 sisyphus+374381.40.2.1 1739299401 installed <13>Aug 3 07:16:12 rpmi: python3-3.12.11-alt1 sisyphus+389751.100.1.1 1752340459 installed <13>Aug 3 07:16:12 rpmi: python3-base-3.12.11-alt1 sisyphus+389751.100.1.1 1752340459 installed <13>Aug 3 07:16:12 rpmi: python3-module-py3dephell-0.3.1-alt1 sisyphus+365261.200.1.1 1734463433 installed <13>Aug 3 07:16:12 rpmi: tests-for-installed-python3-pkgs-0.1.28-alt1 sisyphus+375953.100.2.1 1740855713 installed <13>Aug 3 07:16:12 rpmi: rpm-build-python3-0.1.28-alt1 sisyphus+375953.100.2.1 1740855713 installed <13>Aug 3 07:16:12 rpmi: rpm-build-intro-2.4.9-alt1 sisyphus+385024.100.1.1 1747938414 installed <13>Aug 3 07:16:14 rpmi: python3-module-packaging-25.0-alt1 sisyphus+382195.100.1.1 1745223121 installed <13>Aug 3 07:16:14 rpmi: python3-module-more-itertools-10.7.0-alt1 sisyphus+384072.100.2.1 1747647538 installed <13>Aug 3 07:16:14 rpmi: python3-module-jaraco.functools-4.2.1-alt1 sisyphus+387893.100.1.1 1750561999 installed <13>Aug 3 07:16:14 rpmi: python3-module-typing_extensions-4.14.1-alt1 sisyphus+389153.100.1.1 1751831689 installed <13>Aug 3 07:16:14 rpmi: python3-module-wheel-0.45.1-alt4 sisyphus+384227.100.3.1 1747487276 installed <13>Aug 3 07:16:14 rpmi: python3-module-wcwidth-0.2.13-alt1 sisyphus+341792.100.2.1 1709543329 installed <13>Aug 3 07:16:14 rpmi: python3-module-pyperclip-1.9.0-alt1 sisyphus+353859.100.1.1 1722231798 installed <13>Aug 3 07:16:14 rpmi: python3-module-pluggy-1.6.0-alt1 sisyphus+384666.100.2.1 1747813604 installed <13>Aug 3 07:16:14 rpmi: python3-module-platformdirs-4.3.8-alt1 sisyphus+384104.100.2.1 1747728597 installed <13>Aug 3 07:16:14 rpmi: python3-module-jaraco.context-6.0.1-alt1.1 sisyphus+376369.6200.10.1 1746628448 installed <13>Aug 3 07:16:14 rpmi: python3-module-iniconfig-2.1.0-alt1 sisyphus+378658.100.2.1 1742493599 installed <13>Aug 3 07:16:14 rpmi: python3-module-autocommand-2.2.2-alt1.1 sisyphus+339714.100.1.1 1706968174 installed <13>Aug 3 07:16:14 rpmi: python3-module-jaraco.text-4.0.0-alt1.1 sisyphus+376369.7300.10.1 1746628739 installed <13>Aug 3 07:16:14 rpmi: python3-module-pkg_resources-1:80.9.0-alt1 sisyphus+385748.100.2.1 1748862263 installed <13>Aug 3 07:16:14 rpmi: python3-module-decorator-5.2.1-alt1 sisyphus+376067.100.1.1 1740491622 installed <13>Aug 3 07:16:14 rpmi: python3-module-pycparser-2.22-alt1 sisyphus+378485.100.1.1 1742331206 installed <13>Aug 3 07:16:14 rpmi: python3-module-cffi-1.17.1-alt1 sisyphus+357396.100.1.1 1726156476 installed <13>Aug 3 07:16:14 rpmi: python3-module-cryptography-45.0.3-alt1 sisyphus+385433.100.1.1 1748335036 installed <13>Aug 3 07:16:14 rpmi: python3-module-openssl-25.1.0-alt1.1 sisyphus+385463.100.1.1 1748349146 installed <13>Aug 3 07:16:14 rpmi: python3-module-pycryptodome-3.23.0-alt1 sisyphus+384624.100.1.1 1747676952 installed <13>Aug 3 07:16:14 rpmi: libverto-0.3.2-alt1_1 sisyphus+321176.2200.10.2 1684803947 installed <13>Aug 3 07:16:14 rpmi: libpython3-3.12.11-alt1 sisyphus+389751.100.1.1 1752340459 installed <13>Aug 3 07:16:14 rpmi: libncurses6-6.5.20250705-alt1 sisyphus+389752.100.1.1 1752343158 installed <13>Aug 3 07:16:14 rpmi: libtinfo-devel-6.5.20250705-alt1 sisyphus+389752.100.1.1 1752343158 installed <13>Aug 3 07:16:15 rpmi: libncurses-devel-6.5.20250705-alt1 sisyphus+389752.100.1.1 1752343158 installed <13>Aug 3 07:16:15 rpmi: python3-dev-3.12.11-alt1 sisyphus+389751.100.1.1 1752340459 installed <13>Aug 3 07:16:15 rpmi: liblmdb-0.9.33-alt1 sisyphus+360625.100.1.1 1729819640 installed <13>Aug 3 07:16:15 rpmi: libkeyutils-1.6.3-alt1 sisyphus+346336.200.2.2 1716472658 installed <13>Aug 3 07:16:15 rpmi: libcom_err-1.47.1.0.10.ad56-alt2 sisyphus+363497.200.3.1 1732729908 installed <86>Aug 3 07:16:15 groupadd[2544510]: group added to /etc/group: name=_keytab, GID=999 <86>Aug 3 07:16:15 groupadd[2544510]: group added to /etc/gshadow: name=_keytab <86>Aug 3 07:16:15 groupadd[2544510]: new group: name=_keytab, GID=999 <13>Aug 3 07:16:15 rpmi: libkrb5-1.21.3-alt2 sisyphus+351857.100.1.1 1719735141 installed <13>Aug 3 07:16:15 rpmi: python3-module-gssapi-1.9.0-alt1 sisyphus+359349.100.1.1 1728472724 installed <13>Aug 3 07:16:15 rpmi: python3-module-asyncssh-2.21.0-alt1 sisyphus+383474.100.1.1 1746551078 installed <13>Aug 3 07:16:16 rpmi: python3-module-prompt_toolkit-3.0.51-alt1 sisyphus+381665.100.1.1 1744717056 installed <13>Aug 3 07:16:16 rpmi: python3-module-setuptools-1:80.9.0-alt1 sisyphus+385748.100.2.1 1748862263 installed <13>Aug 3 07:16:16 rpmi: python3-module-pytest-8.3.5-alt3 sisyphus+385748.200.2.1 1748862411 installed <13>Aug 3 07:16:16 rpmi: python3-module-six-1.17.0-alt1.1 sisyphus+373470.100.1.1 1738920023 installed <13>Aug 3 07:16:16 rpmi: python3-module-click-8.2.1-alt1 sisyphus+384735.300.4.1 1747996175 installed Building target platforms: x86_64 Building for target x86_64 Wrote: /usr/src/in/nosrpm/python3-module-click-repl-0.3.0-alt2.nosrc.rpm (w1.gzdio) <13>Aug 3 07:16:17 rpmi: python3-module-pyproject-installer-0.5.5-alt2 sisyphus+366395.100.1.1 1735032014 installed Installing python3-module-click-repl-0.3.0-alt2.src.rpm Building target platforms: x86_64 Building for target x86_64 Executing(%prep): /bin/sh -e /usr/src/tmp/rpm-tmp.87028 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + rm -rf python3-module-click-repl-0.3.0 + echo 'Source #0 (python3-module-click-repl-0.3.0.tar):' Source #0 (python3-module-click-repl-0.3.0.tar): + /bin/tar -xf /usr/src/RPM/SOURCES/python3-module-click-repl-0.3.0.tar + cd python3-module-click-repl-0.3.0 + /bin/chmod -c -Rf u+rwX,go-w . + exit 0 Executing(%build): /bin/sh -e /usr/src/tmp/rpm-tmp.87028 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd python3-module-click-repl-0.3.0 + export 'CFLAGS=-pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto' + CFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto' + export 'CXXFLAGS=-pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto' + CXXFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto' + export 'FFLAGS=-pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto' + FFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto' + /usr/bin/python3 -m pyproject_installer -v build INFO : pyproject_installer.build_cmd._build : Building wheel INFO : pyproject_installer.build_cmd._build : Source tree: /usr/src/RPM/BUILD/python3-module-click-repl-0.3.0 INFO : pyproject_installer.build_cmd._build : Output dir: /usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/dist DEBUG : pyproject_installer.lib.build_backend : Validating source path DEBUG : pyproject_installer.lib.build_backend : Checking for PEP517 spec DEBUG : pyproject_installer.lib.build_backend : Parsing configuration file: /usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/pyproject.toml INFO : backend_caller.py : Calling hook build_wheel in subprocess INFO : backend_caller.py : Build backend: setuptools.build_meta INFO : backend_caller.py : Hook args: ['/usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/dist'] INFO : backend_caller.py : Hook kwargs: {'config_settings': None} INFO : root : running bdist_wheel INFO : root : running build INFO : root : running build_py INFO : root : creating build/lib/click_repl INFO : root : copying click_repl/utils.py -> build/lib/click_repl INFO : root : copying click_repl/exceptions.py -> build/lib/click_repl INFO : root : copying click_repl/_repl.py -> build/lib/click_repl INFO : root : copying click_repl/_completer.py -> build/lib/click_repl INFO : root : copying click_repl/__init__.py -> build/lib/click_repl INFO : root : installing to build/bdist.linux-x86_64/wheel INFO : root : running install INFO : root : running install_lib INFO : root : creating build/bdist.linux-x86_64/wheel INFO : root : creating build/bdist.linux-x86_64/wheel/click_repl INFO : root : copying build/lib/click_repl/__init__.py -> build/bdist.linux-x86_64/wheel/./click_repl INFO : root : copying build/lib/click_repl/_completer.py -> build/bdist.linux-x86_64/wheel/./click_repl INFO : root : copying build/lib/click_repl/_repl.py -> build/bdist.linux-x86_64/wheel/./click_repl INFO : root : copying build/lib/click_repl/exceptions.py -> build/bdist.linux-x86_64/wheel/./click_repl INFO : root : copying build/lib/click_repl/utils.py -> build/bdist.linux-x86_64/wheel/./click_repl INFO : root : running install_egg_info INFO : root : running egg_info INFO : root : creating click_repl.egg-info INFO : root : writing click_repl.egg-info/PKG-INFO INFO : root : writing dependency_links to click_repl.egg-info/dependency_links.txt INFO : root : writing requirements to click_repl.egg-info/requires.txt INFO : root : writing top-level names to click_repl.egg-info/top_level.txt INFO : root : writing manifest file 'click_repl.egg-info/SOURCES.txt' INFO : root : reading manifest file 'click_repl.egg-info/SOURCES.txt' INFO : root : reading manifest template 'MANIFEST.in' INFO : root : adding license file 'LICENSE' INFO : root : writing manifest file 'click_repl.egg-info/SOURCES.txt' INFO : root : Copying click_repl.egg-info to build/bdist.linux-x86_64/wheel/./click_repl-0.3.0-py3.12.egg-info INFO : root : running install_scripts INFO : root : creating build/bdist.linux-x86_64/wheel/click_repl-0.3.0.dist-info/WHEEL INFO : wheel : creating '/usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/dist/.tmp-2wes7l6r/click_repl-0.3.0-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it INFO : wheel : adding 'click_repl/__init__.py' INFO : wheel : adding 'click_repl/_completer.py' INFO : wheel : adding 'click_repl/_repl.py' INFO : wheel : adding 'click_repl/exceptions.py' INFO : wheel : adding 'click_repl/utils.py' INFO : wheel : adding 'click_repl-0.3.0.dist-info/licenses/LICENSE' INFO : wheel : adding 'click_repl-0.3.0.dist-info/METADATA' INFO : wheel : adding 'click_repl-0.3.0.dist-info/WHEEL' INFO : wheel : adding 'click_repl-0.3.0.dist-info/top_level.txt' INFO : wheel : adding 'click_repl-0.3.0.dist-info/RECORD' INFO : root : removing build/bdist.linux-x86_64/wheel INFO : pyproject_installer.build_cmd._build : Built wheel: click_repl-0.3.0-py3-none-any.whl + exit 0 Executing(%install): /bin/sh -e /usr/src/tmp/rpm-tmp.87028 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + /bin/chmod -Rf u+rwX -- /usr/src/tmp/python3-module-click-repl-buildroot + : + /bin/rm -rf -- /usr/src/tmp/python3-module-click-repl-buildroot + PATH=/usr/libexec/rpm-build:/usr/src/bin:/usr/bin:/bin:/usr/local/bin:/usr/games + cd python3-module-click-repl-0.3.0 + /usr/bin/python3 -m pyproject_installer -v install --destdir=/usr/src/tmp/python3-module-click-repl-buildroot INFO : pyproject_installer.install_cmd._install : Installing wheel INFO : pyproject_installer.install_cmd._install : Wheel directory: /usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/dist INFO : pyproject_installer.install_cmd._install : Wheel filename: click_repl-0.3.0-py3-none-any.whl INFO : pyproject_installer.install_cmd._install : Destination: /usr/src/tmp/python3-module-click-repl-buildroot DEBUG : pyproject_installer.lib.wheel : Parsing wheel filename DEBUG : pyproject_installer.lib.wheel : Validating wheel file DEBUG : pyproject_installer.lib.wheel : Validating wheel spec version DEBUG : pyproject_installer.lib.wheel : Parsing wheel spec metadata DEBUG : pyproject_installer.lib.wheel : Validating RECORD INFO : pyproject_installer.install_cmd._install : Wheel installation root: /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages INFO : pyproject_installer.install_cmd._install : Extracting wheel DEBUG : pyproject_installer.install_cmd._install : Filtering out not allowed file: click_repl-0.3.0.dist-info/licenses/LICENSE DEBUG : pyproject_installer.install_cmd._install : Filtering out not allowed file: click_repl-0.3.0.dist-info/WHEEL DEBUG : pyproject_installer.install_cmd._install : Filtering out not allowed file: click_repl-0.3.0.dist-info/top_level.txt DEBUG : pyproject_installer.install_cmd._install : Filtering out not allowed file: click_repl-0.3.0.dist-info/RECORD INFO : pyproject_installer.install_cmd._install : Wheel was installed + /usr/lib/rpm/brp-alt Cleaning files in /usr/src/tmp/python3-module-click-repl-buildroot (auto) Verifying and fixing files in /usr/src/tmp/python3-module-click-repl-buildroot (binconfig,pkgconfig,libtool,desktop,gnuconfig) Checking contents of files in /usr/src/tmp/python3-module-click-repl-buildroot/ (default) Compressing files in /usr/src/tmp/python3-module-click-repl-buildroot (auto) Adjusting library links in /usr/src/tmp/python3-module-click-repl-buildroot ./usr/lib: (from :0) Verifying ELF objects in /usr/src/tmp/python3-module-click-repl-buildroot (arch=normal,fhs=normal,lfs=relaxed,lint=relaxed,rpath=normal,stack=normal,textrel=normal,unresolved=normal) Splitting links to aliased files under /{,s}bin in /usr/src/tmp/python3-module-click-repl-buildroot Bytecompiling python3 modules in /usr/src/tmp/python3-module-click-repl-buildroot using /usr/bin/python3 compile /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages/click_repl/__init__.py compile /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages/click_repl/_completer.py compile /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages/click_repl/_repl.py compile /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages/click_repl/exceptions.py compile /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages/click_repl/utils.py Bytecompiling python3 modules with optimization in /usr/src/tmp/python3-module-click-repl-buildroot using /usr/bin/python3 -O compile /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages/click_repl/__init__.py compile /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages/click_repl/_completer.py compile /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages/click_repl/_repl.py compile /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages/click_repl/exceptions.py compile /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages/click_repl/utils.py Bytecompiling python3 modules with optimization-2 in /usr/src/tmp/python3-module-click-repl-buildroot using /usr/bin/python3 -OO compile /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages/click_repl/__init__.py compile /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages/click_repl/_completer.py compile /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages/click_repl/_repl.py compile /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages/click_repl/exceptions.py compile /usr/src/tmp/python3-module-click-repl-buildroot/usr/lib/python3/site-packages/click_repl/utils.py Hardlinking identical .pyc and .opt-?.pyc files './usr/lib/python3/site-packages/click_repl/__pycache__/__init__.cpython-312.opt-1.pyc' => './usr/lib/python3/site-packages/click_repl/__pycache__/__init__.cpython-312.pyc' './usr/lib/python3/site-packages/click_repl/__pycache__/__init__.cpython-312.opt-2.pyc' => './usr/lib/python3/site-packages/click_repl/__pycache__/__init__.cpython-312.opt-1.pyc' './usr/lib/python3/site-packages/click_repl/__pycache__/_completer.cpython-312.opt-1.pyc' => './usr/lib/python3/site-packages/click_repl/__pycache__/_completer.cpython-312.pyc' './usr/lib/python3/site-packages/click_repl/__pycache__/_completer.cpython-312.opt-2.pyc' => './usr/lib/python3/site-packages/click_repl/__pycache__/_completer.cpython-312.opt-1.pyc' './usr/lib/python3/site-packages/click_repl/__pycache__/_repl.cpython-312.opt-1.pyc' => './usr/lib/python3/site-packages/click_repl/__pycache__/_repl.cpython-312.pyc' './usr/lib/python3/site-packages/click_repl/__pycache__/exceptions.cpython-312.opt-1.pyc' => './usr/lib/python3/site-packages/click_repl/__pycache__/exceptions.cpython-312.pyc' './usr/lib/python3/site-packages/click_repl/__pycache__/exceptions.cpython-312.opt-2.pyc' => './usr/lib/python3/site-packages/click_repl/__pycache__/exceptions.cpython-312.opt-1.pyc' './usr/lib/python3/site-packages/click_repl/__pycache__/utils.cpython-312.opt-1.pyc' => './usr/lib/python3/site-packages/click_repl/__pycache__/utils.cpython-312.pyc' Executing(%check): /bin/sh -e /usr/src/tmp/rpm-tmp.87028 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd python3-module-click-repl-0.3.0 + export 'CFLAGS=-pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto' + CFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto' + export 'CXXFLAGS=-pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto' + CXXFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto' + export 'FFLAGS=-pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto' + FFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto' + export NO_INTERNET=YES + NO_INTERNET=YES + /usr/bin/python3 -m pyproject_installer run -- python3 -m pytest -vra -o=addopts= INFO : Creating venv INFO : Installing console scripts INFO : Installing package: /usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/dist/click_repl-0.3.0-py3-none-any.whl INFO : Running command: ['/usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/.run_venv/bin/python3', '-m', 'pyproject_installer', 'install', '/usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/dist/click_repl-0.3.0-py3-none-any.whl'] INFO : Running command: ['python3', '-m', 'pytest', '-vra', '-o=addopts='] ============================= test session starts ============================== platform linux -- Python 3.12.11, pytest-8.3.5, pluggy-1.6.0 -- /usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/.run_venv/bin/python3 cachedir: .pytest_cache rootdir: /usr/src/RPM/BUILD/python3-module-click-repl-0.3.0 configfile: pyproject.toml testpaths: tests collecting ... collected 61 items / 2 skipped tests/test_basic.py::test_arg_completion FAILED [ 1%] tests/test_basic.py::test_option_completion[option-cmd -expected0] FAILED [ 3%] tests/test_basic.py::test_option_completion[option-cmd -h-expected1] FAILED [ 4%] tests/test_basic.py::test_option_completion[option-cmd --h-expected2] FAILED [ 6%] tests/test_command_collection.py::test_command_collection FAILED [ 8%] tests/test_command_collection.py::test_subcommand_invocation_from_group[ -expected0] PASSED [ 9%] tests/test_command_collection.py::test_subcommand_invocation_from_group[c1 -expected1] PASSED [ 11%] tests/test_completion/test_click_version_le_7/test_arg_completion_v7.py::test_click7_autocomplete_arg SKIPPED [ 13%] tests/test_completion/test_click_version_le_7/test_arg_completion_v7.py::test_tuple_return_type_shell_complete_func_click7 SKIPPED [ 14%] tests/test_completion/test_click_version_le_7/test_option_completion_v7.py::test_click7_autocomplete_option SKIPPED [ 16%] tests/test_completion/test_common_tests/test_arg_completion.py::test_boolean_arg PASSED [ 18%] tests/test_completion/test_common_tests/test_arg_completion.py::test_arg_choices PASSED [ 19%] tests/test_completion/test_common_tests/test_hidden_cmd_and_args.py::test_hidden_cmd PASSED [ 21%] tests/test_completion/test_common_tests/test_hidden_cmd_and_args.py::test_hidden_option FAILED [ 22%] tests/test_completion/test_common_tests/test_hidden_cmd_and_args.py::test_args_of_hidden_command FAILED [ 24%] tests/test_completion/test_common_tests/test_hidden_cmd_and_args.py::test_completion_multilevel_command FAILED [ 26%] tests/test_completion/test_common_tests/test_option_completion.py::test_option_choices PASSED [ 27%] tests/test_completion/test_common_tests/test_option_completion.py::test_boolean_option PASSED [ 29%] tests/test_completion/test_path_type/test_path_type.py::test_path_type_arg[path-type-arg -expected0] PASSED [ 31%] tests/test_completion/test_path_type/test_path_type.py::test_path_type_arg[path-type-arg tests/-expected1] PASSED [ 32%] tests/test_completion/test_path_type/test_path_type.py::test_path_type_arg[path-type-arg src/*-expected2] PASSED [ 34%] tests/test_completion/test_path_type/test_path_type.py::test_path_type_arg[path-type-arg src/**-expected3] PASSED [ 36%] tests/test_completion/test_path_type/test_path_type.py::test_path_type_arg[path-type-arg tests/testdir/-expected4] PASSED [ 37%] tests/test_dev/test_get_internal_cmds.py::test_get_registered_target_help_cmd[help-_help_internal] PASSED [ 39%] tests/test_dev/test_get_internal_cmds.py::test_get_registered_target_help_cmd[h-_help_internal] PASSED [ 40%] tests/test_dev/test_get_internal_cmds.py::test_get_registered_target_help_cmd[?-_help_internal] PASSED [ 42%] tests/test_dev/test_get_internal_cmds.py::test_get_registered_target_exit_cmd[exit-_exit_internal] PASSED [ 44%] tests/test_dev/test_get_internal_cmds.py::test_get_registered_target_exit_cmd[quit-_exit_internal] PASSED [ 45%] tests/test_dev/test_get_internal_cmds.py::test_get_registered_target_exit_cmd[q-_exit_internal] PASSED [ 47%] tests/test_dev/test_get_internal_cmds.py::test_get_registered_target[hi] PASSED [ 49%] tests/test_dev/test_get_internal_cmds.py::test_get_registered_target[hello] PASSED [ 50%] tests/test_dev/test_get_internal_cmds.py::test_get_registered_target[76q358767] PASSED [ 52%] tests/test_dev/test_internal_cmds.py::test_internal_help_commands[:help] PASSED [ 54%] tests/test_dev/test_internal_cmds.py::test_internal_help_commands[:h] PASSED [ 55%] tests/test_dev/test_internal_cmds.py::test_internal_help_commands[:?] PASSED [ 57%] tests/test_dev/test_internal_cmds.py::test_internal_exit_commands[:exit] PASSED [ 59%] tests/test_dev/test_internal_cmds.py::test_internal_exit_commands[:quit] PASSED [ 60%] tests/test_dev/test_internal_cmds.py::test_internal_exit_commands[:q] PASSED [ 62%] tests/test_dev/test_internal_cmds.py::test_no_internal_commands[:exit] PASSED [ 63%] tests/test_dev/test_internal_cmds.py::test_no_internal_commands[:quit] PASSED [ 65%] tests/test_dev/test_internal_cmds.py::test_no_internal_commands[:q] PASSED [ 67%] tests/test_dev/test_register_internal_cmds.py::test_register_cmd_from_str PASSED [ 68%] tests/test_dev/test_register_internal_cmds.py::test_register_func_xfails[test_input0] PASSED [ 70%] tests/test_dev/test_register_internal_cmds.py::test_register_func_xfails[test_input1] PASSED [ 72%] tests/test_dev/test_sys_cmds.py::test_system_commands[!echo hi-hi\n] PASSED [ 73%] tests/test_dev/test_sys_cmds.py::test_system_commands[!echo hi hi-hi hi\n] PASSED [ 75%] tests/test_dev/test_sys_cmds.py::test_system_commands[!-] PASSED [ 77%] tests/test_dev/test_sys_cmds.py::test_no_system_commands[!echo hi] PASSED [ 78%] tests/test_dev/test_sys_cmds.py::test_no_system_commands[!echo hi hi] PASSED [ 80%] tests/test_dev/test_sys_cmds.py::test_no_system_commands[!] PASSED [ 81%] tests/test_repl.py::test_simple_repl PASSED [ 83%] tests/test_repl.py::test_repl_dispatches_subcommand FAILED [ 85%] tests/test_repl.py::test_group_command_called FAILED [ 86%] tests/test_repl.py::test_group_argument_with_required_false[args0-foo\n-InvalidGroupFormat-] PASSED [ 88%] tests/test_repl.py::test_group_argument_with_required_false[args1--SystemExit-] PASSED [ 90%] tests/test_repl.py::test_group_argument_with_required_false[args2-foo\n-SystemExit-Foo\n] FAILED [ 91%] tests/test_repl.py::test_group_with_multiple_optional_args[args0-cli(hi, 1, None)\ncli(hi, 1, None)\nFoo!\n] FAILED [ 93%] tests/test_repl.py::test_group_with_multiple_optional_args[args1-cli(hi, opt1, None)\ncli(hi, opt1, None)\nFoo!\n] FAILED [ 95%] tests/test_repl.py::test_group_with_multiple_optional_args[args2-cli(hi, 1, opt2)\ncli(hi, 1, opt2)\nFoo!\n] FAILED [ 96%] tests/test_repl.py::test_group_with_multiple_optional_args[args3-cli(hi, opt1, opt2)\ncli(hi, opt1, opt2)\nFoo!\n] FAILED [ 98%] tests/test_repl.py::test_inputs PASSED [100%] =================================== FAILURES =================================== _____________________________ test_arg_completion ______________________________ def test_arg_completion(): @root_command.command() @click.argument("handler", type=click.Choice(("foo", "bar"))) def arg_cmd(handler): pass > completions = list(c.get_completions(Document("arg-cmd "))) tests/test_basic.py:21: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ click_repl/_completer.py:257: in get_completions self.parsed_ctx = _resolve_context(args, self.ctx) click_repl/utils.py:46: in _resolve_context name, cmd, args = command.resolve_command(ctx, args) /usr/lib/python3/site-packages/click/core.py:1888: in resolve_command ctx.fail(_("No such command {name!r}.").format(name=original_cmd_name)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = message = "No such command 'arg-cmd'." def fail(self, message: str) -> t.NoReturn: """Aborts the execution of the program with a specific error message. :param message: the error message to fail with. """ > raise UsageError(message, self) E click.exceptions.UsageError: No such command 'arg-cmd'. /usr/lib/python3/site-packages/click/core.py:704: UsageError ________________ test_option_completion[option-cmd -expected0] _________________ test_input = 'option-cmd ', expected = {'--handler', '-h'} @pytest.mark.parametrize( "test_input,expected", [ ("option-cmd ", {"--handler", "-h"}), ("option-cmd -h", {"-h"}), ("option-cmd --h", {"--handler"}), ], ) def test_option_completion(test_input, expected): > completions = list(c.get_completions(Document(test_input))) tests/test_basic.py:40: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ click_repl/_completer.py:257: in get_completions self.parsed_ctx = _resolve_context(args, self.ctx) click_repl/utils.py:46: in _resolve_context name, cmd, args = command.resolve_command(ctx, args) /usr/lib/python3/site-packages/click/core.py:1888: in resolve_command ctx.fail(_("No such command {name!r}.").format(name=original_cmd_name)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = message = "No such command 'option-cmd'." def fail(self, message: str) -> t.NoReturn: """Aborts the execution of the program with a specific error message. :param message: the error message to fail with. """ > raise UsageError(message, self) E click.exceptions.UsageError: No such command 'option-cmd'. /usr/lib/python3/site-packages/click/core.py:704: UsageError _______________ test_option_completion[option-cmd -h-expected1] ________________ test_input = 'option-cmd -h', expected = {'-h'} @pytest.mark.parametrize( "test_input,expected", [ ("option-cmd ", {"--handler", "-h"}), ("option-cmd -h", {"-h"}), ("option-cmd --h", {"--handler"}), ], ) def test_option_completion(test_input, expected): completions = list(c.get_completions(Document(test_input))) > assert {x.text for x in completions} == expected E AssertionError: assert set() == {'-h'} E E Extra items in the right set: E '-h' E E Full diff: E + set() E - { E - '-h', E - } tests/test_basic.py:41: AssertionError _______________ test_option_completion[option-cmd --h-expected2] _______________ test_input = 'option-cmd --h', expected = {'--handler'} @pytest.mark.parametrize( "test_input,expected", [ ("option-cmd ", {"--handler", "-h"}), ("option-cmd -h", {"-h"}), ("option-cmd --h", {"--handler"}), ], ) def test_option_completion(test_input, expected): completions = list(c.get_completions(Document(test_input))) > assert {x.text for x in completions} == expected E AssertionError: assert set() == {'--handler'} E E Extra items in the right set: E '--handler' E E Full diff: E + set() E - { E - '--handler', E - } tests/test_basic.py:41: AssertionError ___________________________ test_command_collection ____________________________ def test_command_collection(): @click.group() def foo_group(): pass @foo_group.command() def foo_cmd(): pass @click.group() def foobar_group(): pass @foobar_group.command() def foobar_cmd(): pass cmd = click.CommandCollection(sources=(foo_group, foobar_group)) c = ClickCompleter(cmd, click.Context(cmd)) completions = list(c.get_completions(Document("foo"))) > assert {x.text for x in completions} == {"foo-cmd", "foobar-cmd"} E AssertionError: assert {'foo', 'foobar'} == {'foo-cmd', 'foobar-cmd'} E E Extra items in the left set: E 'foo' E 'foobar' E Extra items in the right set: E 'foobar-cmd' E 'foo-cmd'... E E ...Full output truncated (10 lines hidden), use '-vv' to show tests/test_command_collection.py:28: AssertionError ______________________________ test_hidden_option ______________________________ def test_hidden_option(): @root_command.command() @click.option("--handler", "-h", hidden=True) def hidden_option_cmd(handler): pass > completions = list(c.get_completions(Document("hidden-option-cmd "))) tests/test_completion/test_common_tests/test_hidden_cmd_and_args.py:30: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ click_repl/_completer.py:257: in get_completions self.parsed_ctx = _resolve_context(args, self.ctx) click_repl/utils.py:46: in _resolve_context name, cmd, args = command.resolve_command(ctx, args) /usr/lib/python3/site-packages/click/core.py:1888: in resolve_command ctx.fail(_("No such command {name!r}.").format(name=original_cmd_name)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = message = "No such command 'hidden-option-cmd'." def fail(self, message: str) -> t.NoReturn: """Aborts the execution of the program with a specific error message. :param message: the error message to fail with. """ > raise UsageError(message, self) E click.exceptions.UsageError: No such command 'hidden-option-cmd'. /usr/lib/python3/site-packages/click/core.py:704: UsageError _________________________ test_args_of_hidden_command __________________________ def test_args_of_hidden_command(): @root_command.command(hidden=True) @click.argument("handler1", type=click.Choice(("foo", "bar"))) @click.option("--handler2", type=click.Choice(("foo", "bar"))) def args_choices_hidden_cmd(handler): pass completions = list(c.get_completions(Document("option-"))) assert {x.text for x in completions} == set() > completions = list(c.get_completions(Document("args-choices-hidden-cmd foo "))) tests/test_completion/test_common_tests/test_hidden_cmd_and_args.py:44: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ click_repl/_completer.py:257: in get_completions self.parsed_ctx = _resolve_context(args, self.ctx) click_repl/utils.py:46: in _resolve_context name, cmd, args = command.resolve_command(ctx, args) /usr/lib/python3/site-packages/click/core.py:1888: in resolve_command ctx.fail(_("No such command {name!r}.").format(name=original_cmd_name)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = message = "No such command 'args-choices-hidden-cmd'." def fail(self, message: str) -> t.NoReturn: """Aborts the execution of the program with a specific error message. :param message: the error message to fail with. """ > raise UsageError(message, self) E click.exceptions.UsageError: No such command 'args-choices-hidden-cmd'. /usr/lib/python3/site-packages/click/core.py:704: UsageError ______________________ test_completion_multilevel_command ______________________ def test_completion_multilevel_command(): @click.group() def root_group(): pass @root_group.group() def first_level_command(): pass @first_level_command.command() def second_level_command_one(): pass @first_level_command.command() def second_level_command_two(): pass c = ClickCompleter(root_group, click.Context(root_group)) > completions = list(c.get_completions(Document("first-level-command "))) tests/test_completion/test_common_tests/test_hidden_cmd_and_args.py:72: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ click_repl/_completer.py:257: in get_completions self.parsed_ctx = _resolve_context(args, self.ctx) click_repl/utils.py:46: in _resolve_context name, cmd, args = command.resolve_command(ctx, args) /usr/lib/python3/site-packages/click/core.py:1888: in resolve_command ctx.fail(_("No such command {name!r}.").format(name=original_cmd_name)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = message = "No such command 'first-level-command'." def fail(self, message: str) -> t.NoReturn: """Aborts the execution of the program with a specific error message. :param message: the error message to fail with. """ > raise UsageError(message, self) E click.exceptions.UsageError: No such command 'first-level-command'. /usr/lib/python3/site-packages/click/core.py:704: UsageError _______________________ test_repl_dispatches_subcommand ________________________ old_ctx = , prompt_kwargs = {} allow_system_commands = True, allow_internal_commands = True def repl( old_ctx, prompt_kwargs={}, allow_system_commands=True, allow_internal_commands=True ): """ Start an interactive shell. All subcommands are available in it. :param old_ctx: The current Click context. :param prompt_kwargs: Parameters passed to :py:func:`prompt_toolkit.PromptSession`. If stdin is not a TTY, no prompt will be printed, but only commands read from stdin. """ group_ctx = old_ctx # Switching to the parent context that has a Group as its command # as a Group acts as a CLI for all of its subcommands if old_ctx.parent is not None and not isinstance(old_ctx.command, click.Group): group_ctx = old_ctx.parent group = group_ctx.command # An Optional click.Argument in the CLI Group, that has no value # will consume the first word from the REPL input, causing issues in # executing the command # So, if there's an empty Optional Argument for param in group.params: if ( isinstance(param, click.Argument) and group_ctx.params[param.name] is None and not param.required ): raise InvalidGroupFormat( f"{type(group).__name__} '{group.name}' requires value for " f"an optional argument '{param.name}' in REPL mode" ) isatty = sys.stdin.isatty() # Delete the REPL command from those available, as we don't want to allow # nesting REPLs (note: pass `None` to `pop` as we don't want to error if # REPL command already not present for some reason). repl_command_name = old_ctx.command.name if isinstance(group_ctx.command, click.CommandCollection): available_commands = { cmd_name: cmd_obj for source in group_ctx.command.sources for cmd_name, cmd_obj in source.commands.items() } else: available_commands = group_ctx.command.commands original_command = available_commands.pop(repl_command_name, None) if isatty: prompt_kwargs = bootstrap_prompt(group, prompt_kwargs, group_ctx) session = PromptSession(**prompt_kwargs) def get_command(): return session.prompt() else: get_command = sys.stdin.readline while True: try: command = get_command() except KeyboardInterrupt: continue except EOFError: break if not command: if isatty: continue else: break try: args = _execute_internal_and_sys_cmds( command, allow_internal_commands, allow_system_commands ) if args is None: continue except CommandLineParserError: continue except ExitReplException: break try: # The group command will dispatch based on args. old_protected_args = group_ctx.protected_args try: > group_ctx.protected_args = args E AttributeError: property 'protected_args' of 'Context' object has no setter click_repl/_repl.py:134: AttributeError During handling of the above exception, another exception occurred: capsys = <_pytest.capture.CaptureFixture object at 0x7f0d687a48c0> def test_repl_dispatches_subcommand(capsys): @click.group(invoke_without_command=True) @click.pass_context def cli(ctx): if ctx.invoked_subcommand is None: click_repl.repl(ctx) @cli.command() def foo(): print("Foo!") with mock_stdin("foo\n"): with pytest.raises(SystemExit): > cli(args=[], prog_name="test_repl_dispatch_subcommand") tests/test_repl.py:42: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/site-packages/click/core.py:1442: in __call__ return self.main(*args, **kwargs) /usr/lib/python3/site-packages/click/core.py:1363: in main rv = self.invoke(ctx) /usr/lib/python3/site-packages/click/core.py:1808: in invoke rv = super().invoke(ctx) /usr/lib/python3/site-packages/click/core.py:1226: in invoke return ctx.invoke(self.callback, **ctx.params) /usr/lib/python3/site-packages/click/core.py:794: in invoke return callback(*args, **kwargs) /usr/lib/python3/site-packages/click/decorators.py:34: in new_func return f(get_current_context(), *args, **kwargs) tests/test_repl.py:34: in cli click_repl.repl(ctx) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ old_ctx = , prompt_kwargs = {} allow_system_commands = True, allow_internal_commands = True def repl( old_ctx, prompt_kwargs={}, allow_system_commands=True, allow_internal_commands=True ): """ Start an interactive shell. All subcommands are available in it. :param old_ctx: The current Click context. :param prompt_kwargs: Parameters passed to :py:func:`prompt_toolkit.PromptSession`. If stdin is not a TTY, no prompt will be printed, but only commands read from stdin. """ group_ctx = old_ctx # Switching to the parent context that has a Group as its command # as a Group acts as a CLI for all of its subcommands if old_ctx.parent is not None and not isinstance(old_ctx.command, click.Group): group_ctx = old_ctx.parent group = group_ctx.command # An Optional click.Argument in the CLI Group, that has no value # will consume the first word from the REPL input, causing issues in # executing the command # So, if there's an empty Optional Argument for param in group.params: if ( isinstance(param, click.Argument) and group_ctx.params[param.name] is None and not param.required ): raise InvalidGroupFormat( f"{type(group).__name__} '{group.name}' requires value for " f"an optional argument '{param.name}' in REPL mode" ) isatty = sys.stdin.isatty() # Delete the REPL command from those available, as we don't want to allow # nesting REPLs (note: pass `None` to `pop` as we don't want to error if # REPL command already not present for some reason). repl_command_name = old_ctx.command.name if isinstance(group_ctx.command, click.CommandCollection): available_commands = { cmd_name: cmd_obj for source in group_ctx.command.sources for cmd_name, cmd_obj in source.commands.items() } else: available_commands = group_ctx.command.commands original_command = available_commands.pop(repl_command_name, None) if isatty: prompt_kwargs = bootstrap_prompt(group, prompt_kwargs, group_ctx) session = PromptSession(**prompt_kwargs) def get_command(): return session.prompt() else: get_command = sys.stdin.readline while True: try: command = get_command() except KeyboardInterrupt: continue except EOFError: break if not command: if isatty: continue else: break try: args = _execute_internal_and_sys_cmds( command, allow_internal_commands, allow_system_commands ) if args is None: continue except CommandLineParserError: continue except ExitReplException: break try: # The group command will dispatch based on args. old_protected_args = group_ctx.protected_args try: group_ctx.protected_args = args group.invoke(group_ctx) finally: > group_ctx.protected_args = old_protected_args E AttributeError: property 'protected_args' of 'Context' object has no setter click_repl/_repl.py:137: AttributeError __________________________ test_group_command_called ___________________________ old_ctx = , prompt_kwargs = {} allow_system_commands = True, allow_internal_commands = True def repl( old_ctx, prompt_kwargs={}, allow_system_commands=True, allow_internal_commands=True ): """ Start an interactive shell. All subcommands are available in it. :param old_ctx: The current Click context. :param prompt_kwargs: Parameters passed to :py:func:`prompt_toolkit.PromptSession`. If stdin is not a TTY, no prompt will be printed, but only commands read from stdin. """ group_ctx = old_ctx # Switching to the parent context that has a Group as its command # as a Group acts as a CLI for all of its subcommands if old_ctx.parent is not None and not isinstance(old_ctx.command, click.Group): group_ctx = old_ctx.parent group = group_ctx.command # An Optional click.Argument in the CLI Group, that has no value # will consume the first word from the REPL input, causing issues in # executing the command # So, if there's an empty Optional Argument for param in group.params: if ( isinstance(param, click.Argument) and group_ctx.params[param.name] is None and not param.required ): raise InvalidGroupFormat( f"{type(group).__name__} '{group.name}' requires value for " f"an optional argument '{param.name}' in REPL mode" ) isatty = sys.stdin.isatty() # Delete the REPL command from those available, as we don't want to allow # nesting REPLs (note: pass `None` to `pop` as we don't want to error if # REPL command already not present for some reason). repl_command_name = old_ctx.command.name if isinstance(group_ctx.command, click.CommandCollection): available_commands = { cmd_name: cmd_obj for source in group_ctx.command.sources for cmd_name, cmd_obj in source.commands.items() } else: available_commands = group_ctx.command.commands original_command = available_commands.pop(repl_command_name, None) if isatty: prompt_kwargs = bootstrap_prompt(group, prompt_kwargs, group_ctx) session = PromptSession(**prompt_kwargs) def get_command(): return session.prompt() else: get_command = sys.stdin.readline while True: try: command = get_command() except KeyboardInterrupt: continue except EOFError: break if not command: if isatty: continue else: break try: args = _execute_internal_and_sys_cmds( command, allow_internal_commands, allow_system_commands ) if args is None: continue except CommandLineParserError: continue except ExitReplException: break try: # The group command will dispatch based on args. old_protected_args = group_ctx.protected_args try: > group_ctx.protected_args = args E AttributeError: property 'protected_args' of 'Context' object has no setter click_repl/_repl.py:134: AttributeError During handling of the above exception, another exception occurred: capsys = <_pytest.capture.CaptureFixture object at 0x7f0d687a5d90> def test_group_command_called(capsys): @click.group(invoke_without_command=True) @click.pass_context def cli(ctx): print("cli()") if ctx.invoked_subcommand is None: click_repl.repl(ctx) @cli.command() def foo(): print("Foo!") @cli.command() def bar(): print("Bar!") with mock_stdin("foo\nbar\n"): with pytest.raises(SystemExit): > cli(args=[], prog_name="test_group_called") tests/test_repl.py:65: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/site-packages/click/core.py:1442: in __call__ return self.main(*args, **kwargs) /usr/lib/python3/site-packages/click/core.py:1363: in main rv = self.invoke(ctx) /usr/lib/python3/site-packages/click/core.py:1808: in invoke rv = super().invoke(ctx) /usr/lib/python3/site-packages/click/core.py:1226: in invoke return ctx.invoke(self.callback, **ctx.params) /usr/lib/python3/site-packages/click/core.py:794: in invoke return callback(*args, **kwargs) /usr/lib/python3/site-packages/click/decorators.py:34: in new_func return f(get_current_context(), *args, **kwargs) tests/test_repl.py:53: in cli click_repl.repl(ctx) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ old_ctx = , prompt_kwargs = {} allow_system_commands = True, allow_internal_commands = True def repl( old_ctx, prompt_kwargs={}, allow_system_commands=True, allow_internal_commands=True ): """ Start an interactive shell. All subcommands are available in it. :param old_ctx: The current Click context. :param prompt_kwargs: Parameters passed to :py:func:`prompt_toolkit.PromptSession`. If stdin is not a TTY, no prompt will be printed, but only commands read from stdin. """ group_ctx = old_ctx # Switching to the parent context that has a Group as its command # as a Group acts as a CLI for all of its subcommands if old_ctx.parent is not None and not isinstance(old_ctx.command, click.Group): group_ctx = old_ctx.parent group = group_ctx.command # An Optional click.Argument in the CLI Group, that has no value # will consume the first word from the REPL input, causing issues in # executing the command # So, if there's an empty Optional Argument for param in group.params: if ( isinstance(param, click.Argument) and group_ctx.params[param.name] is None and not param.required ): raise InvalidGroupFormat( f"{type(group).__name__} '{group.name}' requires value for " f"an optional argument '{param.name}' in REPL mode" ) isatty = sys.stdin.isatty() # Delete the REPL command from those available, as we don't want to allow # nesting REPLs (note: pass `None` to `pop` as we don't want to error if # REPL command already not present for some reason). repl_command_name = old_ctx.command.name if isinstance(group_ctx.command, click.CommandCollection): available_commands = { cmd_name: cmd_obj for source in group_ctx.command.sources for cmd_name, cmd_obj in source.commands.items() } else: available_commands = group_ctx.command.commands original_command = available_commands.pop(repl_command_name, None) if isatty: prompt_kwargs = bootstrap_prompt(group, prompt_kwargs, group_ctx) session = PromptSession(**prompt_kwargs) def get_command(): return session.prompt() else: get_command = sys.stdin.readline while True: try: command = get_command() except KeyboardInterrupt: continue except EOFError: break if not command: if isatty: continue else: break try: args = _execute_internal_and_sys_cmds( command, allow_internal_commands, allow_system_commands ) if args is None: continue except CommandLineParserError: continue except ExitReplException: break try: # The group command will dispatch based on args. old_protected_args = group_ctx.protected_args try: group_ctx.protected_args = args group.invoke(group_ctx) finally: > group_ctx.protected_args = old_protected_args E AttributeError: property 'protected_args' of 'Context' object has no setter click_repl/_repl.py:137: AttributeError ----------------------------- Captured stdout call ----------------------------- cli() ____ test_group_argument_with_required_false[args2-foo\n-SystemExit-Foo\n] _____ old_ctx = , prompt_kwargs = {} allow_system_commands = True, allow_internal_commands = True def repl( old_ctx, prompt_kwargs={}, allow_system_commands=True, allow_internal_commands=True ): """ Start an interactive shell. All subcommands are available in it. :param old_ctx: The current Click context. :param prompt_kwargs: Parameters passed to :py:func:`prompt_toolkit.PromptSession`. If stdin is not a TTY, no prompt will be printed, but only commands read from stdin. """ group_ctx = old_ctx # Switching to the parent context that has a Group as its command # as a Group acts as a CLI for all of its subcommands if old_ctx.parent is not None and not isinstance(old_ctx.command, click.Group): group_ctx = old_ctx.parent group = group_ctx.command # An Optional click.Argument in the CLI Group, that has no value # will consume the first word from the REPL input, causing issues in # executing the command # So, if there's an empty Optional Argument for param in group.params: if ( isinstance(param, click.Argument) and group_ctx.params[param.name] is None and not param.required ): raise InvalidGroupFormat( f"{type(group).__name__} '{group.name}' requires value for " f"an optional argument '{param.name}' in REPL mode" ) isatty = sys.stdin.isatty() # Delete the REPL command from those available, as we don't want to allow # nesting REPLs (note: pass `None` to `pop` as we don't want to error if # REPL command already not present for some reason). repl_command_name = old_ctx.command.name if isinstance(group_ctx.command, click.CommandCollection): available_commands = { cmd_name: cmd_obj for source in group_ctx.command.sources for cmd_name, cmd_obj in source.commands.items() } else: available_commands = group_ctx.command.commands original_command = available_commands.pop(repl_command_name, None) if isatty: prompt_kwargs = bootstrap_prompt(group, prompt_kwargs, group_ctx) session = PromptSession(**prompt_kwargs) def get_command(): return session.prompt() else: get_command = sys.stdin.readline while True: try: command = get_command() except KeyboardInterrupt: continue except EOFError: break if not command: if isatty: continue else: break try: args = _execute_internal_and_sys_cmds( command, allow_internal_commands, allow_system_commands ) if args is None: continue except CommandLineParserError: continue except ExitReplException: break try: # The group command will dispatch based on args. old_protected_args = group_ctx.protected_args try: > group_ctx.protected_args = args E AttributeError: property 'protected_args' of 'Context' object has no setter click_repl/_repl.py:134: AttributeError During handling of the above exception, another exception occurred: capsys = <_pytest.capture.CaptureFixture object at 0x7f0d687a4680> args = ['temp_arg'], stdin = 'foo\n', expected_err = expected_output = 'Foo\n' @pytest.mark.parametrize( "args, stdin, expected_err, expected_output", [ ([], "foo\n", click_repl.exceptions.InvalidGroupFormat, ""), (["temp_arg"], "", SystemExit, ""), (["temp_arg"], "foo\n", SystemExit, "Foo\n"), ], ) def test_group_argument_with_required_false( capsys, args, stdin, expected_err, expected_output ): with pytest.raises(expected_err): with mock_stdin(stdin): > cli_arg_required_false(args=args, prog_name="cli_arg_required_false") tests/test_repl.py:98: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/site-packages/click/core.py:1442: in __call__ return self.main(*args, **kwargs) /usr/lib/python3/site-packages/click/core.py:1363: in main rv = self.invoke(ctx) /usr/lib/python3/site-packages/click/core.py:1808: in invoke rv = super().invoke(ctx) /usr/lib/python3/site-packages/click/core.py:1226: in invoke return ctx.invoke(self.callback, **ctx.params) /usr/lib/python3/site-packages/click/core.py:794: in invoke return callback(*args, **kwargs) /usr/lib/python3/site-packages/click/decorators.py:34: in new_func return f(get_current_context(), *args, **kwargs) tests/test_repl.py:77: in cli_arg_required_false click_repl.repl(ctx) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ old_ctx = , prompt_kwargs = {} allow_system_commands = True, allow_internal_commands = True def repl( old_ctx, prompt_kwargs={}, allow_system_commands=True, allow_internal_commands=True ): """ Start an interactive shell. All subcommands are available in it. :param old_ctx: The current Click context. :param prompt_kwargs: Parameters passed to :py:func:`prompt_toolkit.PromptSession`. If stdin is not a TTY, no prompt will be printed, but only commands read from stdin. """ group_ctx = old_ctx # Switching to the parent context that has a Group as its command # as a Group acts as a CLI for all of its subcommands if old_ctx.parent is not None and not isinstance(old_ctx.command, click.Group): group_ctx = old_ctx.parent group = group_ctx.command # An Optional click.Argument in the CLI Group, that has no value # will consume the first word from the REPL input, causing issues in # executing the command # So, if there's an empty Optional Argument for param in group.params: if ( isinstance(param, click.Argument) and group_ctx.params[param.name] is None and not param.required ): raise InvalidGroupFormat( f"{type(group).__name__} '{group.name}' requires value for " f"an optional argument '{param.name}' in REPL mode" ) isatty = sys.stdin.isatty() # Delete the REPL command from those available, as we don't want to allow # nesting REPLs (note: pass `None` to `pop` as we don't want to error if # REPL command already not present for some reason). repl_command_name = old_ctx.command.name if isinstance(group_ctx.command, click.CommandCollection): available_commands = { cmd_name: cmd_obj for source in group_ctx.command.sources for cmd_name, cmd_obj in source.commands.items() } else: available_commands = group_ctx.command.commands original_command = available_commands.pop(repl_command_name, None) if isatty: prompt_kwargs = bootstrap_prompt(group, prompt_kwargs, group_ctx) session = PromptSession(**prompt_kwargs) def get_command(): return session.prompt() else: get_command = sys.stdin.readline while True: try: command = get_command() except KeyboardInterrupt: continue except EOFError: break if not command: if isatty: continue else: break try: args = _execute_internal_and_sys_cmds( command, allow_internal_commands, allow_system_commands ) if args is None: continue except CommandLineParserError: continue except ExitReplException: break try: # The group command will dispatch based on args. old_protected_args = group_ctx.protected_args try: group_ctx.protected_args = args group.invoke(group_ctx) finally: > group_ctx.protected_args = old_protected_args E AttributeError: property 'protected_args' of 'Context' object has no setter click_repl/_repl.py:137: AttributeError _ test_group_with_multiple_optional_args[args0-cli(hi, 1, None)\ncli(hi, 1, None)\nFoo!\n] _ old_ctx = , prompt_kwargs = {} allow_system_commands = True, allow_internal_commands = True def repl( old_ctx, prompt_kwargs={}, allow_system_commands=True, allow_internal_commands=True ): """ Start an interactive shell. All subcommands are available in it. :param old_ctx: The current Click context. :param prompt_kwargs: Parameters passed to :py:func:`prompt_toolkit.PromptSession`. If stdin is not a TTY, no prompt will be printed, but only commands read from stdin. """ group_ctx = old_ctx # Switching to the parent context that has a Group as its command # as a Group acts as a CLI for all of its subcommands if old_ctx.parent is not None and not isinstance(old_ctx.command, click.Group): group_ctx = old_ctx.parent group = group_ctx.command # An Optional click.Argument in the CLI Group, that has no value # will consume the first word from the REPL input, causing issues in # executing the command # So, if there's an empty Optional Argument for param in group.params: if ( isinstance(param, click.Argument) and group_ctx.params[param.name] is None and not param.required ): raise InvalidGroupFormat( f"{type(group).__name__} '{group.name}' requires value for " f"an optional argument '{param.name}' in REPL mode" ) isatty = sys.stdin.isatty() # Delete the REPL command from those available, as we don't want to allow # nesting REPLs (note: pass `None` to `pop` as we don't want to error if # REPL command already not present for some reason). repl_command_name = old_ctx.command.name if isinstance(group_ctx.command, click.CommandCollection): available_commands = { cmd_name: cmd_obj for source in group_ctx.command.sources for cmd_name, cmd_obj in source.commands.items() } else: available_commands = group_ctx.command.commands original_command = available_commands.pop(repl_command_name, None) if isatty: prompt_kwargs = bootstrap_prompt(group, prompt_kwargs, group_ctx) session = PromptSession(**prompt_kwargs) def get_command(): return session.prompt() else: get_command = sys.stdin.readline while True: try: command = get_command() except KeyboardInterrupt: continue except EOFError: break if not command: if isatty: continue else: break try: args = _execute_internal_and_sys_cmds( command, allow_internal_commands, allow_system_commands ) if args is None: continue except CommandLineParserError: continue except ExitReplException: break try: # The group command will dispatch based on args. old_protected_args = group_ctx.protected_args try: > group_ctx.protected_args = args E AttributeError: property 'protected_args' of 'Context' object has no setter click_repl/_repl.py:134: AttributeError During handling of the above exception, another exception occurred: capsys = <_pytest.capture.CaptureFixture object at 0x7f0d688445c0> args = ['hi'], expected = 'cli(hi, 1, None)\ncli(hi, 1, None)\nFoo!\n' @pytest.mark.parametrize( "args, expected", [ (["hi"], "cli(hi, 1, None)\ncli(hi, 1, None)\nFoo!\n"), ( ["--option1", "opt1", "hi"], "cli(hi, opt1, None)\ncli(hi, opt1, None)\nFoo!\n", ), (["--option2", "opt2", "hi"], "cli(hi, 1, opt2)\ncli(hi, 1, opt2)\nFoo!\n"), ( ["--option1", "opt1", "--option2", "opt2", "hi"], "cli(hi, opt1, opt2)\ncli(hi, opt1, opt2)\nFoo!\n", ), ], ) def test_group_with_multiple_optional_args(capsys, args, expected): with pytest.raises(SystemExit): with mock_stdin("foo\n"): > cmd(args=args, prog_name="test_group_with_multiple_args") tests/test_repl.py:137: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/site-packages/click/core.py:1442: in __call__ return self.main(*args, **kwargs) /usr/lib/python3/site-packages/click/core.py:1363: in main rv = self.invoke(ctx) /usr/lib/python3/site-packages/click/core.py:1808: in invoke rv = super().invoke(ctx) /usr/lib/python3/site-packages/click/core.py:1226: in invoke return ctx.invoke(self.callback, **ctx.params) /usr/lib/python3/site-packages/click/core.py:794: in invoke return callback(*args, **kwargs) /usr/lib/python3/site-packages/click/decorators.py:34: in new_func return f(get_current_context(), *args, **kwargs) tests/test_repl.py:111: in cmd click_repl.repl(ctx) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ old_ctx = , prompt_kwargs = {} allow_system_commands = True, allow_internal_commands = True def repl( old_ctx, prompt_kwargs={}, allow_system_commands=True, allow_internal_commands=True ): """ Start an interactive shell. All subcommands are available in it. :param old_ctx: The current Click context. :param prompt_kwargs: Parameters passed to :py:func:`prompt_toolkit.PromptSession`. If stdin is not a TTY, no prompt will be printed, but only commands read from stdin. """ group_ctx = old_ctx # Switching to the parent context that has a Group as its command # as a Group acts as a CLI for all of its subcommands if old_ctx.parent is not None and not isinstance(old_ctx.command, click.Group): group_ctx = old_ctx.parent group = group_ctx.command # An Optional click.Argument in the CLI Group, that has no value # will consume the first word from the REPL input, causing issues in # executing the command # So, if there's an empty Optional Argument for param in group.params: if ( isinstance(param, click.Argument) and group_ctx.params[param.name] is None and not param.required ): raise InvalidGroupFormat( f"{type(group).__name__} '{group.name}' requires value for " f"an optional argument '{param.name}' in REPL mode" ) isatty = sys.stdin.isatty() # Delete the REPL command from those available, as we don't want to allow # nesting REPLs (note: pass `None` to `pop` as we don't want to error if # REPL command already not present for some reason). repl_command_name = old_ctx.command.name if isinstance(group_ctx.command, click.CommandCollection): available_commands = { cmd_name: cmd_obj for source in group_ctx.command.sources for cmd_name, cmd_obj in source.commands.items() } else: available_commands = group_ctx.command.commands original_command = available_commands.pop(repl_command_name, None) if isatty: prompt_kwargs = bootstrap_prompt(group, prompt_kwargs, group_ctx) session = PromptSession(**prompt_kwargs) def get_command(): return session.prompt() else: get_command = sys.stdin.readline while True: try: command = get_command() except KeyboardInterrupt: continue except EOFError: break if not command: if isatty: continue else: break try: args = _execute_internal_and_sys_cmds( command, allow_internal_commands, allow_system_commands ) if args is None: continue except CommandLineParserError: continue except ExitReplException: break try: # The group command will dispatch based on args. old_protected_args = group_ctx.protected_args try: group_ctx.protected_args = args group.invoke(group_ctx) finally: > group_ctx.protected_args = old_protected_args E AttributeError: property 'protected_args' of 'Context' object has no setter click_repl/_repl.py:137: AttributeError ----------------------------- Captured stdout call ----------------------------- cli(hi, 1, None) _ test_group_with_multiple_optional_args[args1-cli(hi, opt1, None)\ncli(hi, opt1, None)\nFoo!\n] _ old_ctx = , prompt_kwargs = {} allow_system_commands = True, allow_internal_commands = True def repl( old_ctx, prompt_kwargs={}, allow_system_commands=True, allow_internal_commands=True ): """ Start an interactive shell. All subcommands are available in it. :param old_ctx: The current Click context. :param prompt_kwargs: Parameters passed to :py:func:`prompt_toolkit.PromptSession`. If stdin is not a TTY, no prompt will be printed, but only commands read from stdin. """ group_ctx = old_ctx # Switching to the parent context that has a Group as its command # as a Group acts as a CLI for all of its subcommands if old_ctx.parent is not None and not isinstance(old_ctx.command, click.Group): group_ctx = old_ctx.parent group = group_ctx.command # An Optional click.Argument in the CLI Group, that has no value # will consume the first word from the REPL input, causing issues in # executing the command # So, if there's an empty Optional Argument for param in group.params: if ( isinstance(param, click.Argument) and group_ctx.params[param.name] is None and not param.required ): raise InvalidGroupFormat( f"{type(group).__name__} '{group.name}' requires value for " f"an optional argument '{param.name}' in REPL mode" ) isatty = sys.stdin.isatty() # Delete the REPL command from those available, as we don't want to allow # nesting REPLs (note: pass `None` to `pop` as we don't want to error if # REPL command already not present for some reason). repl_command_name = old_ctx.command.name if isinstance(group_ctx.command, click.CommandCollection): available_commands = { cmd_name: cmd_obj for source in group_ctx.command.sources for cmd_name, cmd_obj in source.commands.items() } else: available_commands = group_ctx.command.commands original_command = available_commands.pop(repl_command_name, None) if isatty: prompt_kwargs = bootstrap_prompt(group, prompt_kwargs, group_ctx) session = PromptSession(**prompt_kwargs) def get_command(): return session.prompt() else: get_command = sys.stdin.readline while True: try: command = get_command() except KeyboardInterrupt: continue except EOFError: break if not command: if isatty: continue else: break try: args = _execute_internal_and_sys_cmds( command, allow_internal_commands, allow_system_commands ) if args is None: continue except CommandLineParserError: continue except ExitReplException: break try: # The group command will dispatch based on args. old_protected_args = group_ctx.protected_args try: > group_ctx.protected_args = args E AttributeError: property 'protected_args' of 'Context' object has no setter click_repl/_repl.py:134: AttributeError During handling of the above exception, another exception occurred: capsys = <_pytest.capture.CaptureFixture object at 0x7f0d68845700> args = ['--option1', 'opt1', 'hi'] expected = 'cli(hi, opt1, None)\ncli(hi, opt1, None)\nFoo!\n' @pytest.mark.parametrize( "args, expected", [ (["hi"], "cli(hi, 1, None)\ncli(hi, 1, None)\nFoo!\n"), ( ["--option1", "opt1", "hi"], "cli(hi, opt1, None)\ncli(hi, opt1, None)\nFoo!\n", ), (["--option2", "opt2", "hi"], "cli(hi, 1, opt2)\ncli(hi, 1, opt2)\nFoo!\n"), ( ["--option1", "opt1", "--option2", "opt2", "hi"], "cli(hi, opt1, opt2)\ncli(hi, opt1, opt2)\nFoo!\n", ), ], ) def test_group_with_multiple_optional_args(capsys, args, expected): with pytest.raises(SystemExit): with mock_stdin("foo\n"): > cmd(args=args, prog_name="test_group_with_multiple_args") tests/test_repl.py:137: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/site-packages/click/core.py:1442: in __call__ return self.main(*args, **kwargs) /usr/lib/python3/site-packages/click/core.py:1363: in main rv = self.invoke(ctx) /usr/lib/python3/site-packages/click/core.py:1808: in invoke rv = super().invoke(ctx) /usr/lib/python3/site-packages/click/core.py:1226: in invoke return ctx.invoke(self.callback, **ctx.params) /usr/lib/python3/site-packages/click/core.py:794: in invoke return callback(*args, **kwargs) /usr/lib/python3/site-packages/click/decorators.py:34: in new_func return f(get_current_context(), *args, **kwargs) tests/test_repl.py:111: in cmd click_repl.repl(ctx) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ old_ctx = , prompt_kwargs = {} allow_system_commands = True, allow_internal_commands = True def repl( old_ctx, prompt_kwargs={}, allow_system_commands=True, allow_internal_commands=True ): """ Start an interactive shell. All subcommands are available in it. :param old_ctx: The current Click context. :param prompt_kwargs: Parameters passed to :py:func:`prompt_toolkit.PromptSession`. If stdin is not a TTY, no prompt will be printed, but only commands read from stdin. """ group_ctx = old_ctx # Switching to the parent context that has a Group as its command # as a Group acts as a CLI for all of its subcommands if old_ctx.parent is not None and not isinstance(old_ctx.command, click.Group): group_ctx = old_ctx.parent group = group_ctx.command # An Optional click.Argument in the CLI Group, that has no value # will consume the first word from the REPL input, causing issues in # executing the command # So, if there's an empty Optional Argument for param in group.params: if ( isinstance(param, click.Argument) and group_ctx.params[param.name] is None and not param.required ): raise InvalidGroupFormat( f"{type(group).__name__} '{group.name}' requires value for " f"an optional argument '{param.name}' in REPL mode" ) isatty = sys.stdin.isatty() # Delete the REPL command from those available, as we don't want to allow # nesting REPLs (note: pass `None` to `pop` as we don't want to error if # REPL command already not present for some reason). repl_command_name = old_ctx.command.name if isinstance(group_ctx.command, click.CommandCollection): available_commands = { cmd_name: cmd_obj for source in group_ctx.command.sources for cmd_name, cmd_obj in source.commands.items() } else: available_commands = group_ctx.command.commands original_command = available_commands.pop(repl_command_name, None) if isatty: prompt_kwargs = bootstrap_prompt(group, prompt_kwargs, group_ctx) session = PromptSession(**prompt_kwargs) def get_command(): return session.prompt() else: get_command = sys.stdin.readline while True: try: command = get_command() except KeyboardInterrupt: continue except EOFError: break if not command: if isatty: continue else: break try: args = _execute_internal_and_sys_cmds( command, allow_internal_commands, allow_system_commands ) if args is None: continue except CommandLineParserError: continue except ExitReplException: break try: # The group command will dispatch based on args. old_protected_args = group_ctx.protected_args try: group_ctx.protected_args = args group.invoke(group_ctx) finally: > group_ctx.protected_args = old_protected_args E AttributeError: property 'protected_args' of 'Context' object has no setter click_repl/_repl.py:137: AttributeError ----------------------------- Captured stdout call ----------------------------- cli(hi, opt1, None) _ test_group_with_multiple_optional_args[args2-cli(hi, 1, opt2)\ncli(hi, 1, opt2)\nFoo!\n] _ old_ctx = , prompt_kwargs = {} allow_system_commands = True, allow_internal_commands = True def repl( old_ctx, prompt_kwargs={}, allow_system_commands=True, allow_internal_commands=True ): """ Start an interactive shell. All subcommands are available in it. :param old_ctx: The current Click context. :param prompt_kwargs: Parameters passed to :py:func:`prompt_toolkit.PromptSession`. If stdin is not a TTY, no prompt will be printed, but only commands read from stdin. """ group_ctx = old_ctx # Switching to the parent context that has a Group as its command # as a Group acts as a CLI for all of its subcommands if old_ctx.parent is not None and not isinstance(old_ctx.command, click.Group): group_ctx = old_ctx.parent group = group_ctx.command # An Optional click.Argument in the CLI Group, that has no value # will consume the first word from the REPL input, causing issues in # executing the command # So, if there's an empty Optional Argument for param in group.params: if ( isinstance(param, click.Argument) and group_ctx.params[param.name] is None and not param.required ): raise InvalidGroupFormat( f"{type(group).__name__} '{group.name}' requires value for " f"an optional argument '{param.name}' in REPL mode" ) isatty = sys.stdin.isatty() # Delete the REPL command from those available, as we don't want to allow # nesting REPLs (note: pass `None` to `pop` as we don't want to error if # REPL command already not present for some reason). repl_command_name = old_ctx.command.name if isinstance(group_ctx.command, click.CommandCollection): available_commands = { cmd_name: cmd_obj for source in group_ctx.command.sources for cmd_name, cmd_obj in source.commands.items() } else: available_commands = group_ctx.command.commands original_command = available_commands.pop(repl_command_name, None) if isatty: prompt_kwargs = bootstrap_prompt(group, prompt_kwargs, group_ctx) session = PromptSession(**prompt_kwargs) def get_command(): return session.prompt() else: get_command = sys.stdin.readline while True: try: command = get_command() except KeyboardInterrupt: continue except EOFError: break if not command: if isatty: continue else: break try: args = _execute_internal_and_sys_cmds( command, allow_internal_commands, allow_system_commands ) if args is None: continue except CommandLineParserError: continue except ExitReplException: break try: # The group command will dispatch based on args. old_protected_args = group_ctx.protected_args try: > group_ctx.protected_args = args E AttributeError: property 'protected_args' of 'Context' object has no setter click_repl/_repl.py:134: AttributeError During handling of the above exception, another exception occurred: capsys = <_pytest.capture.CaptureFixture object at 0x7f0d687a54c0> args = ['--option2', 'opt2', 'hi'] expected = 'cli(hi, 1, opt2)\ncli(hi, 1, opt2)\nFoo!\n' @pytest.mark.parametrize( "args, expected", [ (["hi"], "cli(hi, 1, None)\ncli(hi, 1, None)\nFoo!\n"), ( ["--option1", "opt1", "hi"], "cli(hi, opt1, None)\ncli(hi, opt1, None)\nFoo!\n", ), (["--option2", "opt2", "hi"], "cli(hi, 1, opt2)\ncli(hi, 1, opt2)\nFoo!\n"), ( ["--option1", "opt1", "--option2", "opt2", "hi"], "cli(hi, opt1, opt2)\ncli(hi, opt1, opt2)\nFoo!\n", ), ], ) def test_group_with_multiple_optional_args(capsys, args, expected): with pytest.raises(SystemExit): with mock_stdin("foo\n"): > cmd(args=args, prog_name="test_group_with_multiple_args") tests/test_repl.py:137: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/site-packages/click/core.py:1442: in __call__ return self.main(*args, **kwargs) /usr/lib/python3/site-packages/click/core.py:1363: in main rv = self.invoke(ctx) /usr/lib/python3/site-packages/click/core.py:1808: in invoke rv = super().invoke(ctx) /usr/lib/python3/site-packages/click/core.py:1226: in invoke return ctx.invoke(self.callback, **ctx.params) /usr/lib/python3/site-packages/click/core.py:794: in invoke return callback(*args, **kwargs) /usr/lib/python3/site-packages/click/decorators.py:34: in new_func return f(get_current_context(), *args, **kwargs) tests/test_repl.py:111: in cmd click_repl.repl(ctx) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ old_ctx = , prompt_kwargs = {} allow_system_commands = True, allow_internal_commands = True def repl( old_ctx, prompt_kwargs={}, allow_system_commands=True, allow_internal_commands=True ): """ Start an interactive shell. All subcommands are available in it. :param old_ctx: The current Click context. :param prompt_kwargs: Parameters passed to :py:func:`prompt_toolkit.PromptSession`. If stdin is not a TTY, no prompt will be printed, but only commands read from stdin. """ group_ctx = old_ctx # Switching to the parent context that has a Group as its command # as a Group acts as a CLI for all of its subcommands if old_ctx.parent is not None and not isinstance(old_ctx.command, click.Group): group_ctx = old_ctx.parent group = group_ctx.command # An Optional click.Argument in the CLI Group, that has no value # will consume the first word from the REPL input, causing issues in # executing the command # So, if there's an empty Optional Argument for param in group.params: if ( isinstance(param, click.Argument) and group_ctx.params[param.name] is None and not param.required ): raise InvalidGroupFormat( f"{type(group).__name__} '{group.name}' requires value for " f"an optional argument '{param.name}' in REPL mode" ) isatty = sys.stdin.isatty() # Delete the REPL command from those available, as we don't want to allow # nesting REPLs (note: pass `None` to `pop` as we don't want to error if # REPL command already not present for some reason). repl_command_name = old_ctx.command.name if isinstance(group_ctx.command, click.CommandCollection): available_commands = { cmd_name: cmd_obj for source in group_ctx.command.sources for cmd_name, cmd_obj in source.commands.items() } else: available_commands = group_ctx.command.commands original_command = available_commands.pop(repl_command_name, None) if isatty: prompt_kwargs = bootstrap_prompt(group, prompt_kwargs, group_ctx) session = PromptSession(**prompt_kwargs) def get_command(): return session.prompt() else: get_command = sys.stdin.readline while True: try: command = get_command() except KeyboardInterrupt: continue except EOFError: break if not command: if isatty: continue else: break try: args = _execute_internal_and_sys_cmds( command, allow_internal_commands, allow_system_commands ) if args is None: continue except CommandLineParserError: continue except ExitReplException: break try: # The group command will dispatch based on args. old_protected_args = group_ctx.protected_args try: group_ctx.protected_args = args group.invoke(group_ctx) finally: > group_ctx.protected_args = old_protected_args E AttributeError: property 'protected_args' of 'Context' object has no setter click_repl/_repl.py:137: AttributeError ----------------------------- Captured stdout call ----------------------------- cli(hi, 1, opt2) _ test_group_with_multiple_optional_args[args3-cli(hi, opt1, opt2)\ncli(hi, opt1, opt2)\nFoo!\n] _ old_ctx = , prompt_kwargs = {} allow_system_commands = True, allow_internal_commands = True def repl( old_ctx, prompt_kwargs={}, allow_system_commands=True, allow_internal_commands=True ): """ Start an interactive shell. All subcommands are available in it. :param old_ctx: The current Click context. :param prompt_kwargs: Parameters passed to :py:func:`prompt_toolkit.PromptSession`. If stdin is not a TTY, no prompt will be printed, but only commands read from stdin. """ group_ctx = old_ctx # Switching to the parent context that has a Group as its command # as a Group acts as a CLI for all of its subcommands if old_ctx.parent is not None and not isinstance(old_ctx.command, click.Group): group_ctx = old_ctx.parent group = group_ctx.command # An Optional click.Argument in the CLI Group, that has no value # will consume the first word from the REPL input, causing issues in # executing the command # So, if there's an empty Optional Argument for param in group.params: if ( isinstance(param, click.Argument) and group_ctx.params[param.name] is None and not param.required ): raise InvalidGroupFormat( f"{type(group).__name__} '{group.name}' requires value for " f"an optional argument '{param.name}' in REPL mode" ) isatty = sys.stdin.isatty() # Delete the REPL command from those available, as we don't want to allow # nesting REPLs (note: pass `None` to `pop` as we don't want to error if # REPL command already not present for some reason). repl_command_name = old_ctx.command.name if isinstance(group_ctx.command, click.CommandCollection): available_commands = { cmd_name: cmd_obj for source in group_ctx.command.sources for cmd_name, cmd_obj in source.commands.items() } else: available_commands = group_ctx.command.commands original_command = available_commands.pop(repl_command_name, None) if isatty: prompt_kwargs = bootstrap_prompt(group, prompt_kwargs, group_ctx) session = PromptSession(**prompt_kwargs) def get_command(): return session.prompt() else: get_command = sys.stdin.readline while True: try: command = get_command() except KeyboardInterrupt: continue except EOFError: break if not command: if isatty: continue else: break try: args = _execute_internal_and_sys_cmds( command, allow_internal_commands, allow_system_commands ) if args is None: continue except CommandLineParserError: continue except ExitReplException: break try: # The group command will dispatch based on args. old_protected_args = group_ctx.protected_args try: > group_ctx.protected_args = args E AttributeError: property 'protected_args' of 'Context' object has no setter click_repl/_repl.py:134: AttributeError During handling of the above exception, another exception occurred: capsys = <_pytest.capture.CaptureFixture object at 0x7f0d68845310> args = ['--option1', 'opt1', '--option2', 'opt2', 'hi'] expected = 'cli(hi, opt1, opt2)\ncli(hi, opt1, opt2)\nFoo!\n' @pytest.mark.parametrize( "args, expected", [ (["hi"], "cli(hi, 1, None)\ncli(hi, 1, None)\nFoo!\n"), ( ["--option1", "opt1", "hi"], "cli(hi, opt1, None)\ncli(hi, opt1, None)\nFoo!\n", ), (["--option2", "opt2", "hi"], "cli(hi, 1, opt2)\ncli(hi, 1, opt2)\nFoo!\n"), ( ["--option1", "opt1", "--option2", "opt2", "hi"], "cli(hi, opt1, opt2)\ncli(hi, opt1, opt2)\nFoo!\n", ), ], ) def test_group_with_multiple_optional_args(capsys, args, expected): with pytest.raises(SystemExit): with mock_stdin("foo\n"): > cmd(args=args, prog_name="test_group_with_multiple_args") tests/test_repl.py:137: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/site-packages/click/core.py:1442: in __call__ return self.main(*args, **kwargs) /usr/lib/python3/site-packages/click/core.py:1363: in main rv = self.invoke(ctx) /usr/lib/python3/site-packages/click/core.py:1808: in invoke rv = super().invoke(ctx) /usr/lib/python3/site-packages/click/core.py:1226: in invoke return ctx.invoke(self.callback, **ctx.params) /usr/lib/python3/site-packages/click/core.py:794: in invoke return callback(*args, **kwargs) /usr/lib/python3/site-packages/click/decorators.py:34: in new_func return f(get_current_context(), *args, **kwargs) tests/test_repl.py:111: in cmd click_repl.repl(ctx) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ old_ctx = , prompt_kwargs = {} allow_system_commands = True, allow_internal_commands = True def repl( old_ctx, prompt_kwargs={}, allow_system_commands=True, allow_internal_commands=True ): """ Start an interactive shell. All subcommands are available in it. :param old_ctx: The current Click context. :param prompt_kwargs: Parameters passed to :py:func:`prompt_toolkit.PromptSession`. If stdin is not a TTY, no prompt will be printed, but only commands read from stdin. """ group_ctx = old_ctx # Switching to the parent context that has a Group as its command # as a Group acts as a CLI for all of its subcommands if old_ctx.parent is not None and not isinstance(old_ctx.command, click.Group): group_ctx = old_ctx.parent group = group_ctx.command # An Optional click.Argument in the CLI Group, that has no value # will consume the first word from the REPL input, causing issues in # executing the command # So, if there's an empty Optional Argument for param in group.params: if ( isinstance(param, click.Argument) and group_ctx.params[param.name] is None and not param.required ): raise InvalidGroupFormat( f"{type(group).__name__} '{group.name}' requires value for " f"an optional argument '{param.name}' in REPL mode" ) isatty = sys.stdin.isatty() # Delete the REPL command from those available, as we don't want to allow # nesting REPLs (note: pass `None` to `pop` as we don't want to error if # REPL command already not present for some reason). repl_command_name = old_ctx.command.name if isinstance(group_ctx.command, click.CommandCollection): available_commands = { cmd_name: cmd_obj for source in group_ctx.command.sources for cmd_name, cmd_obj in source.commands.items() } else: available_commands = group_ctx.command.commands original_command = available_commands.pop(repl_command_name, None) if isatty: prompt_kwargs = bootstrap_prompt(group, prompt_kwargs, group_ctx) session = PromptSession(**prompt_kwargs) def get_command(): return session.prompt() else: get_command = sys.stdin.readline while True: try: command = get_command() except KeyboardInterrupt: continue except EOFError: break if not command: if isatty: continue else: break try: args = _execute_internal_and_sys_cmds( command, allow_internal_commands, allow_system_commands ) if args is None: continue except CommandLineParserError: continue except ExitReplException: break try: # The group command will dispatch based on args. old_protected_args = group_ctx.protected_args try: group_ctx.protected_args = args group.invoke(group_ctx) finally: > group_ctx.protected_args = old_protected_args E AttributeError: property 'protected_args' of 'Context' object has no setter click_repl/_repl.py:137: AttributeError ----------------------------- Captured stdout call ----------------------------- cli(hi, opt1, opt2) =============================== warnings summary =============================== tests/test_completion/test_click_version_le_7/test_arg_completion_v7.py:16 /usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/tests/test_completion/test_click_version_le_7/test_arg_completion_v7.py:16: DeprecationWarning: The '__version__' attribute is deprecated and will be removed in Click 9.1. Use feature detection or 'importlib.metadata.version("click")' instead. click.__version__[0] > "7", tests/test_completion/test_click_version_le_7/test_arg_completion_v7.py:33 /usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/tests/test_completion/test_click_version_le_7/test_arg_completion_v7.py:33: DeprecationWarning: The '__version__' attribute is deprecated and will be removed in Click 9.1. Use feature detection or 'importlib.metadata.version("click")' instead. click.__version__[0] > "7", tests/test_completion/test_click_version_le_7/test_option_completion_v7.py:16 /usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/tests/test_completion/test_click_version_le_7/test_option_completion_v7.py:16: DeprecationWarning: The '__version__' attribute is deprecated and will be removed in Click 9.1. Use feature detection or 'importlib.metadata.version("click")' instead. click.__version__[0] > "7", tests/test_basic.py: 2 warnings tests/test_command_collection.py: 1 warning tests/test_completion/test_common_tests/test_arg_completion.py: 2 warnings tests/test_completion/test_common_tests/test_hidden_cmd_and_args.py: 3 warnings tests/test_completion/test_common_tests/test_option_completion.py: 2 warnings tests/test_completion/test_path_type/test_path_type.py: 1 warning /usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/click_repl/utils.py:44: DeprecationWarning: 'MultiCommand' is deprecated and will be removed in Click 9.0. Use 'Group' instead. if isinstance(command, click.MultiCommand): tests/test_basic.py: 2 warnings tests/test_command_collection.py: 3 warnings tests/test_completion/test_common_tests/test_arg_completion.py: 3 warnings tests/test_completion/test_common_tests/test_hidden_cmd_and_args.py: 2 warnings tests/test_completion/test_common_tests/test_option_completion.py: 3 warnings tests/test_completion/test_path_type/test_path_type.py: 5 warnings /usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/click_repl/_completer.py:270: DeprecationWarning: 'MultiCommand' is deprecated and will be removed in Click 9.0. Use 'Group' instead. if isinstance(self.ctx_command, click.MultiCommand): tests/test_command_collection.py::test_subcommand_invocation_from_group[c1 -expected1] tests/test_completion/test_common_tests/test_arg_completion.py::test_boolean_arg tests/test_completion/test_common_tests/test_arg_completion.py::test_arg_choices tests/test_completion/test_common_tests/test_option_completion.py::test_option_choices tests/test_completion/test_common_tests/test_option_completion.py::test_boolean_option tests/test_completion/test_path_type/test_path_type.py::test_path_type_arg[path-type-arg -expected0] /usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/click_repl/utils.py:52: DeprecationWarning: 'protected_args' is deprecated and will be removed in Click 9.0. 'args' will contain remaining unparsed tokens. args = ctx.protected_args + ctx.args tests/test_repl.py::test_repl_dispatches_subcommand tests/test_repl.py::test_group_command_called tests/test_repl.py::test_group_argument_with_required_false[args2-foo\n-SystemExit-Foo\n] tests/test_repl.py::test_group_with_multiple_optional_args[args0-cli(hi, 1, None)\ncli(hi, 1, None)\nFoo!\n] tests/test_repl.py::test_group_with_multiple_optional_args[args1-cli(hi, opt1, None)\ncli(hi, opt1, None)\nFoo!\n] tests/test_repl.py::test_group_with_multiple_optional_args[args2-cli(hi, 1, opt2)\ncli(hi, 1, opt2)\nFoo!\n] tests/test_repl.py::test_group_with_multiple_optional_args[args3-cli(hi, opt1, opt2)\ncli(hi, opt1, opt2)\nFoo!\n] /usr/src/RPM/BUILD/python3-module-click-repl-0.3.0/click_repl/_repl.py:132: DeprecationWarning: 'protected_args' is deprecated and will be removed in Click 9.0. 'args' will contain remaining unparsed tokens. old_protected_args = group_ctx.protected_args -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ SKIPPED [1] tests/test_completion/test_click_version_ge_8/test_arg_completion_v8.py:14: click-v8 built-in shell complete is not available, so skipped SKIPPED [1] tests/test_completion/test_click_version_ge_8/test_option_completion_v8.py:14: click-v8 built-in shell complete is not available, so skipped SKIPPED [1] tests/test_completion/test_click_version_le_7/test_arg_completion_v7.py:15: click-v7 old autocomplete function is not available, so skipped SKIPPED [1] tests/test_completion/test_click_version_le_7/test_arg_completion_v7.py:32: click-v7 old autocomplete function is not available, so skipped SKIPPED [1] tests/test_completion/test_click_version_le_7/test_option_completion_v7.py:15: click-v7 old autocomplete function is not available, so skipped FAILED tests/test_basic.py::test_arg_completion - click.exceptions.UsageError... FAILED tests/test_basic.py::test_option_completion[option-cmd -expected0] - c... FAILED tests/test_basic.py::test_option_completion[option-cmd -h-expected1] FAILED tests/test_basic.py::test_option_completion[option-cmd --h-expected2] FAILED tests/test_command_collection.py::test_command_collection - AssertionE... FAILED tests/test_completion/test_common_tests/test_hidden_cmd_and_args.py::test_hidden_option FAILED tests/test_completion/test_common_tests/test_hidden_cmd_and_args.py::test_args_of_hidden_command FAILED tests/test_completion/test_common_tests/test_hidden_cmd_and_args.py::test_completion_multilevel_command FAILED tests/test_repl.py::test_repl_dispatches_subcommand - AttributeError: ... FAILED tests/test_repl.py::test_group_command_called - AttributeError: proper... FAILED tests/test_repl.py::test_group_argument_with_required_false[args2-foo\n-SystemExit-Foo\n] FAILED tests/test_repl.py::test_group_with_multiple_optional_args[args0-cli(hi, 1, None)\ncli(hi, 1, None)\nFoo!\n] FAILED tests/test_repl.py::test_group_with_multiple_optional_args[args1-cli(hi, opt1, None)\ncli(hi, opt1, None)\nFoo!\n] FAILED tests/test_repl.py::test_group_with_multiple_optional_args[args2-cli(hi, 1, opt2)\ncli(hi, 1, opt2)\nFoo!\n] FAILED tests/test_repl.py::test_group_with_multiple_optional_args[args3-cli(hi, opt1, opt2)\ncli(hi, opt1, opt2)\nFoo!\n] ============ 15 failed, 43 passed, 5 skipped, 45 warnings in 0.80s ============= INFO : Command's result: FAILURE INFO : Command's error: Command '['python3', '-m', 'pytest', '-vra', '-o=addopts=']' returned non-zero exit status 1. error: Bad exit status from /usr/src/tmp/rpm-tmp.87028 (%check) RPM build errors: Bad exit status from /usr/src/tmp/rpm-tmp.87028 (%check) Command exited with non-zero status 1 1.58user 0.54system 0:02.07elapsed 102%CPU (0avgtext+0avgdata 48716maxresident)k 0inputs+0outputs (0major+109035minor)pagefaults 0swaps hsh-rebuild: rebuild of `python3-module-click-repl-0.3.0-alt2.src.rpm' failed. Command exited with non-zero status 1 4.15user 3.33system 0:15.03elapsed 49%CPU (0avgtext+0avgdata 144428maxresident)k 10192inputs+0outputs (0major+326599minor)pagefaults 0swaps