Mock Version: 4.0 Mock Version: 4.0 Mock Version: 4.0 ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --noclean --target noarch --nodeps /builddir/build/SPECS/python-click.spec'], chrootPath='/var/lib/mock/inferit-8_8-build-19266-28569/root'env={'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'}shell=Falselogger=timeout=86400uid=991gid=135user='mockbuild'nspawn_args=['--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.nl85iffc:/etc/resolv.conf', '--bind=/dev/mapper/control', '--bind=/dev/loop-control', '--bind=/dev/loop0', '--bind=/dev/loop1', '--bind=/dev/loop2', '--bind=/dev/loop3', '--bind=/dev/loop4', '--bind=/dev/loop5', '--bind=/dev/loop6', '--bind=/dev/loop7', '--bind=/dev/loop8', '--bind=/dev/loop9', '--bind=/dev/loop10', '--bind=/dev/loop11']unshare_net=TrueprintOutput=False) Using nspawn with args ['--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.nl85iffc:/etc/resolv.conf', '--bind=/dev/mapper/control', '--bind=/dev/loop-control', '--bind=/dev/loop0', '--bind=/dev/loop1', '--bind=/dev/loop2', '--bind=/dev/loop3', '--bind=/dev/loop4', '--bind=/dev/loop5', '--bind=/dev/loop6', '--bind=/dev/loop7', '--bind=/dev/loop8', '--bind=/dev/loop9', '--bind=/dev/loop10', '--bind=/dev/loop11'] Executing command: ['/usr/bin/systemd-nspawn', '-q', '-M', '4ca28c1ff03e460b8d53b75ac9869309', '-D', '/var/lib/mock/inferit-8_8-build-19266-28569/root', '-a', '-u', 'mockbuild', '--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.nl85iffc:/etc/resolv.conf', '--bind=/dev/mapper/control', '--bind=/dev/loop-control', '--bind=/dev/loop0', '--bind=/dev/loop1', '--bind=/dev/loop2', '--bind=/dev/loop3', '--bind=/dev/loop4', '--bind=/dev/loop5', '--bind=/dev/loop6', '--bind=/dev/loop7', '--bind=/dev/loop8', '--bind=/dev/loop9', '--bind=/dev/loop10', '--bind=/dev/loop11', '--console=pipe', '--setenv=TERM=vt100', '--setenv=SHELL=/bin/bash', '--setenv=HOME=/builddir', '--setenv=HOSTNAME=mock', '--setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin', '--setenv=PROMPT_COMMAND=printf "\\033]0;\\007"', '--setenv=PS1= \\s-\\v\\$ ', '--setenv=LANG=C.UTF-8', '--resolv-conf=off', 'bash', '--login', '-c', '/usr/bin/rpmbuild -bs --noclean --target noarch --nodeps /builddir/build/SPECS/python-click.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8', 'SYSTEMD_NSPAWN_TMPFS_TMP': '0', 'SYSTEMD_SECCOMP': '0'} and shell False Building target platforms: noarch Building for target noarch Wrote: /builddir/build/SRPMS/python-click-6.7-8.el8.src.rpm Child return code was: 0 ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bb --noclean --target noarch --nodeps /builddir/build/SPECS/python-click.spec'], chrootPath='/var/lib/mock/inferit-8_8-build-19266-28569/root'env={'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'}shell=Falselogger=timeout=86400uid=991gid=135user='mockbuild'nspawn_args=['--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.nl85iffc:/etc/resolv.conf', '--bind=/dev/mapper/control', '--bind=/dev/loop-control', '--bind=/dev/loop0', '--bind=/dev/loop1', '--bind=/dev/loop2', '--bind=/dev/loop3', '--bind=/dev/loop4', '--bind=/dev/loop5', '--bind=/dev/loop6', '--bind=/dev/loop7', '--bind=/dev/loop8', '--bind=/dev/loop9', '--bind=/dev/loop10', '--bind=/dev/loop11']unshare_net=TrueprintOutput=False) Using nspawn with args ['--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.nl85iffc:/etc/resolv.conf', '--bind=/dev/mapper/control', '--bind=/dev/loop-control', '--bind=/dev/loop0', '--bind=/dev/loop1', '--bind=/dev/loop2', '--bind=/dev/loop3', '--bind=/dev/loop4', '--bind=/dev/loop5', '--bind=/dev/loop6', '--bind=/dev/loop7', '--bind=/dev/loop8', '--bind=/dev/loop9', '--bind=/dev/loop10', '--bind=/dev/loop11'] Executing command: ['/usr/bin/systemd-nspawn', '-q', '-M', '7051221fd703443c80ab3640dcb0e534', '-D', '/var/lib/mock/inferit-8_8-build-19266-28569/root', '-a', '-u', 'mockbuild', '--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.nl85iffc:/etc/resolv.conf', '--bind=/dev/mapper/control', '--bind=/dev/loop-control', '--bind=/dev/loop0', '--bind=/dev/loop1', '--bind=/dev/loop2', '--bind=/dev/loop3', '--bind=/dev/loop4', '--bind=/dev/loop5', '--bind=/dev/loop6', '--bind=/dev/loop7', '--bind=/dev/loop8', '--bind=/dev/loop9', '--bind=/dev/loop10', '--bind=/dev/loop11', '--console=pipe', '--setenv=TERM=vt100', '--setenv=SHELL=/bin/bash', '--setenv=HOME=/builddir', '--setenv=HOSTNAME=mock', '--setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin', '--setenv=PROMPT_COMMAND=printf "\\033]0;\\007"', '--setenv=PS1= \\s-\\v\\$ ', '--setenv=LANG=C.UTF-8', '--resolv-conf=off', 'bash', '--login', '-c', '/usr/bin/rpmbuild -bb --noclean --target noarch --nodeps /builddir/build/SPECS/python-click.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8', 'SYSTEMD_NSPAWN_TMPFS_TMP': '0', 'SYSTEMD_SECCOMP': '0'} and shell False Building target platforms: noarch Building for target noarch Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.A9Jh2z + umask 022 + cd /builddir/build/BUILD + cd /builddir/build/BUILD + rm -rf click-6.7 + /usr/bin/gzip -dc /builddir/build/SOURCES/click-6.7.tar.gz + /usr/bin/tar -xof - + STATUS=0 + '[' 0 -ne 0 ']' + cd click-6.7 + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . + /usr/bin/cat /builddir/build/SOURCES/0001-Remove-outdated-comment-about-Click-3.0.patch + /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch + /usr/bin/cat /builddir/build/SOURCES/0002-Add-pytest-option-to-not-capture-warnings.patch + /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch + /usr/bin/cat /builddir/build/SOURCES/0003-Catch-and-test-pytest-warning.patch + /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch + exit 0 Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.HlU7fJ + umask 022 + cd /builddir/build/BUILD + cd click-6.7 + CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' + LDFLAGS='-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' + /usr/libexec/platform-python setup.py build '--executable=/usr/libexec/platform-python -s' running build running build_py creating build creating build/lib creating build/lib/click copying click/__init__.py -> build/lib/click copying click/_bashcomplete.py -> build/lib/click copying click/_compat.py -> build/lib/click copying click/_termui_impl.py -> build/lib/click copying click/_textwrap.py -> build/lib/click copying click/_unicodefun.py -> build/lib/click copying click/_winconsole.py -> build/lib/click copying click/core.py -> build/lib/click copying click/decorators.py -> build/lib/click copying click/exceptions.py -> build/lib/click copying click/formatting.py -> build/lib/click copying click/globals.py -> build/lib/click copying click/parser.py -> build/lib/click copying click/termui.py -> build/lib/click copying click/testing.py -> build/lib/click copying click/types.py -> build/lib/click copying click/utils.py -> build/lib/click + sleep 1 + exit 0 Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.Z2r0zG + umask 022 + cd /builddir/build/BUILD + '[' /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch '!=' / ']' + rm -rf /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch ++ dirname /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch + mkdir -p /builddir/build/BUILDROOT + mkdir /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch + cd click-6.7 + CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' + LDFLAGS='-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' + /usr/libexec/platform-python setup.py install -O1 --skip-build --root /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch running install running install_lib creating /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr creating /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib creating /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6 creating /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages creating /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/__init__.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/_bashcomplete.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/_compat.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/_termui_impl.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/_textwrap.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/_unicodefun.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/_winconsole.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/core.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/decorators.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/exceptions.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/formatting.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/globals.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/parser.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/termui.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/testing.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/types.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click copying build/lib/click/utils.py -> /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/__init__.py to __init__.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/_bashcomplete.py to _bashcomplete.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/_compat.py to _compat.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/_termui_impl.py to _termui_impl.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/_textwrap.py to _textwrap.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/_unicodefun.py to _unicodefun.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/_winconsole.py to _winconsole.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/core.py to core.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/decorators.py to decorators.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/exceptions.py to exceptions.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/formatting.py to formatting.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/globals.py to globals.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/parser.py to parser.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/termui.py to termui.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/testing.py to testing.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/types.py to types.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click/utils.py to utils.cpython-36.pyc writing byte-compilation script '/tmp/tmpyj2untb1.py' /usr/libexec/platform-python /tmp/tmpyj2untb1.py removing /tmp/tmpyj2untb1.py running install_egg_info running egg_info creating click.egg-info writing click.egg-info/PKG-INFO writing dependency_links to click.egg-info/dependency_links.txt writing top-level names to click.egg-info/top_level.txt writing manifest file 'click.egg-info/SOURCES.txt' reading manifest file 'click.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'docs' warning: no previously-included files matching '*.pyc' found under directory 'tests' warning: no previously-included files matching '*.pyo' found under directory 'tests' warning: no previously-included files matching '*.pyc' found under directory 'examples' warning: no previously-included files matching '*.pyo' found under directory 'examples' no previously-included directories found matching 'docs/_build' writing manifest file 'click.egg-info/SOURCES.txt' Copying click.egg-info to /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6/site-packages/click-6.7-py3.6.egg-info running install_scripts + /usr/lib/rpm/find-debuginfo.sh -j16 --strict-build-id -m -i --build-id-seed 6.7-8.el8 --unique-debug-suffix -6.7-8.el8.noarch --unique-debug-src-base python-click-6.7-8.el8.noarch --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 50000000 -S debugsourcefiles.list /builddir/build/BUILD/click-6.7 find: 'debug': No such file or directory + /usr/lib/rpm/check-buildroot + /usr/lib/rpm/redhat/brp-ldconfig /sbin/ldconfig: Warning: ignoring configuration file that cannot be opened: /etc/ld.so.conf: No such file or directory + /usr/lib/rpm/brp-compress + /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip + /usr/lib/rpm/brp-python-bytecompile '' 1 Bytecompiling .py files below /builddir/build/BUILDROOT/python-click-6.7-8.el8.noarch/usr/lib/python3.6 using /usr/libexec/platform-python + /usr/lib/rpm/brp-python-hardlink + PYTHON3=/usr/libexec/platform-python + /usr/lib/rpm/redhat/brp-mangle-shebangs Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.aMfE0v + umask 022 + cd /builddir/build/BUILD + cd click-6.7 ++ pwd + export PYTHONPATH=/builddir/build/BUILD/click-6.7 + PYTHONPATH=/builddir/build/BUILD/click-6.7 + export LC_ALL=en_US.UTF-8 + LC_ALL=en_US.UTF-8 /var/tmp/rpm-tmp.aMfE0v: line 35: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory /var/tmp/rpm-tmp.aMfE0v: line 35: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) + py.test-3.6 tests --tb=long --verbose /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) ============================= test session starts ============================== platform linux -- Python 3.6.8, pytest-3.4.2, py-1.5.3, pluggy-0.6.0 -- /usr/libexec/platform-python cachedir: .pytest_cache rootdir: /builddir/build/BUILD/click-6.7, inifile: collecting ... collected 120 items tests/test_arguments.py::test_nargs_star FAILED [ 0%] tests/test_arguments.py::test_nargs_default PASSED [ 1%] tests/test_arguments.py::test_nargs_tup FAILED [ 2%] tests/test_arguments.py::test_nargs_tup_composite FAILED [ 3%] tests/test_arguments.py::test_nargs_err FAILED [ 4%] tests/test_arguments.py::test_file_args FAILED [ 5%] tests/test_arguments.py::test_path_args FAILED [ 5%] tests/test_arguments.py::test_file_atomics FAILED [ 6%] tests/test_arguments.py::test_stdout_default FAILED [ 7%] tests/test_arguments.py::test_nargs_envvar FAILED [ 8%] tests/test_arguments.py::test_empty_nargs FAILED [ 9%] tests/test_arguments.py::test_missing_arg FAILED [ 10%] tests/test_arguments.py::test_implicit_non_required FAILED [ 10%] tests/test_arguments.py::test_eat_options FAILED [ 11%] tests/test_arguments.py::test_nargs_star_ordering FAILED [ 12%] tests/test_arguments.py::test_nargs_specified_plus_star_ordering FAILED [ 13%] tests/test_arguments.py::test_defaults_for_nargs FAILED [ 14%] tests/test_bashcomplete.py::test_single_command PASSED [ 15%] tests/test_bashcomplete.py::test_small_chain PASSED [ 15%] tests/test_bashcomplete.py::test_long_chain PASSED [ 16%] tests/test_basic.py::test_basic_functionality FAILED [ 17%] tests/test_basic.py::test_return_values PASSED [ 18%] tests/test_basic.py::test_basic_group FAILED [ 19%] tests/test_basic.py::test_basic_option FAILED [ 20%] tests/test_basic.py::test_int_option FAILED [ 20%] tests/test_basic.py::test_uuid_option FAILED [ 21%] tests/test_basic.py::test_float_option FAILED [ 22%] tests/test_basic.py::test_boolean_option FAILED [ 23%] tests/test_basic.py::test_file_option FAILED [ 24%] tests/test_basic.py::test_file_lazy_mode FAILED [ 25%] tests/test_basic.py::test_path_option FAILED [ 25%] tests/test_basic.py::test_choice_option FAILED [ 26%] tests/test_basic.py::test_int_range_option FAILED [ 27%] tests/test_basic.py::test_required_option FAILED [ 28%] tests/test_basic.py::test_evaluation_order FAILED [ 29%] tests/test_chain.py::test_basic_chaining FAILED [ 30%] tests/test_chain.py::test_chaining_help FAILED [ 30%] tests/test_chain.py::test_chaining_with_options FAILED [ 31%] tests/test_chain.py::test_chaining_with_arguments FAILED [ 32%] tests/test_chain.py::test_pipeline FAILED [ 33%] tests/test_chain.py::test_args_and_chain FAILED [ 34%] tests/test_chain.py::test_multicommand_arg_behavior FAILED [ 35%] tests/test_chain.py::test_multicommand_chaining xfail [ 35%] tests/test_commands.py::test_other_command_invoke FAILED [ 36%] tests/test_commands.py::test_other_command_forward FAILED [ 37%] tests/test_commands.py::test_auto_shorthelp FAILED [ 38%] tests/test_commands.py::test_default_maps FAILED [ 39%] tests/test_commands.py::test_group_with_args FAILED [ 40%] tests/test_commands.py::test_base_command FAILED [ 40%] tests/test_commands.py::test_object_propagation FAILED [ 41%] tests/test_commands.py::test_other_command_invoke_with_defaults FAILED [ 42%] tests/test_commands.py::test_invoked_subcommand FAILED [ 43%] tests/test_commands.py::test_unprocessed_options FAILED [ 44%] tests/test_compat.py::test_legacy_callbacks FAILED [ 45%] tests/test_compat.py::test_bash_func_name PASSED [ 45%] tests/test_context.py::test_ensure_context_objects FAILED [ 46%] tests/test_context.py::test_get_context_objects FAILED [ 47%] tests/test_context.py::test_get_context_objects_no_ensuring FAILED [ 48%] tests/test_context.py::test_get_context_objects_missing FAILED [ 49%] tests/test_context.py::test_multi_enter FAILED [ 50%] tests/test_context.py::test_global_context_object FAILED [ 50%] tests/test_context.py::test_context_meta FAILED [ 51%] tests/test_context.py::test_context_pushing PASSED [ 52%] tests/test_context.py::test_pass_obj FAILED [ 53%] tests/test_context.py::test_close_before_pop FAILED [ 54%] tests/test_defaults.py::test_basic_defaults FAILED [ 55%] tests/test_defaults.py::test_multiple_defaults FAILED [ 55%] tests/test_defaults.py::test_nargs_plus_multiple FAILED [ 56%] tests/test_formatting.py::test_basic_functionality FAILED [ 57%] tests/test_formatting.py::test_wrapping_long_options_strings FAILED [ 58%] tests/test_formatting.py::test_wrapping_long_command_name FAILED [ 59%] tests/test_formatting.py::test_formatting_empty_help_lines FAILED [ 60%] tests/test_imports.py::test_light_imports PASSED [ 60%] tests/test_normalization.py::test_option_normalization FAILED [ 61%] tests/test_normalization.py::test_choice_normalization FAILED [ 62%] tests/test_normalization.py::test_command_normalization FAILED [ 63%] tests/test_options.py::test_prefixes FAILED [ 64%] tests/test_options.py::test_invalid_option PASSED [ 65%] tests/test_options.py::test_invalid_nargs PASSED [ 65%] tests/test_options.py::test_nargs_tup_composite_mult FAILED [ 66%] tests/test_options.py::test_counting FAILED [ 67%] tests/test_options.py::test_unknown_options[--foo] FAILED [ 68%] tests/test_options.py::test_unknown_options[-f] FAILED [ 69%] tests/test_options.py::test_multiple_required FAILED [ 70%] tests/test_options.py::test_multiple_envvar FAILED [ 70%] tests/test_options.py::test_multiple_default_help FAILED [ 71%] tests/test_options.py::test_multiple_default_type FAILED [ 72%] tests/test_options.py::test_nargs_envvar FAILED [ 73%] tests/test_options.py::test_custom_validation FAILED [ 74%] tests/test_options.py::test_winstyle_options FAILED [ 75%] tests/test_options.py::test_legacy_options FAILED [ 75%] tests/test_options.py::test_missing_choice FAILED [ 76%] tests/test_options.py::test_multiline_help FAILED [ 77%] tests/test_options.py::test_argument_custom_class FAILED [ 78%] tests/test_options.py::test_option_custom_class FAILED [ 79%] tests/test_options.py::test_aliases_for_flags FAILED [ 80%] tests/test_termui.py::test_progressbar_strip_regression FAILED [ 80%] tests/test_testing.py::test_runner FAILED [ 81%] tests/test_testing.py::test_runner_with_stream FAILED [ 82%] tests/test_testing.py::test_prompts FAILED [ 83%] tests/test_testing.py::test_getchar FAILED [ 84%] tests/test_testing.py::test_catch_exceptions FAILED [ 85%] tests/test_testing.py::test_with_color FAILED [ 85%] tests/test_testing.py::test_with_color_but_pause_not_blocking FAILED [ 86%] tests/test_testing.py::test_exit_code_and_output_from_sys_exit FAILED [ 87%] tests/test_testing.py::test_env FAILED [ 88%] tests/test_utils.py::test_echo FAILED [ 89%] tests/test_utils.py::test_echo_custom_file PASSED [ 90%] tests/test_utils.py::test_styling PASSED [ 90%] tests/test_utils.py::test_filename_formatting PASSED [ 91%] tests/test_utils.py::test_prompts FAILED [ 92%] tests/test_utils.py::test_prompts_abort PASSED [ 93%] tests/test_utils.py::test_echo_via_pager[cat] PASSED [ 94%] tests/test_utils.py::test_echo_via_pager[cat 0] PASSED [ 95%] tests/test_utils.py::test_echo_via_pager[cat 1] PASSED [ 95%] tests/test_utils.py::test_echo_color_flag PASSED [ 96%] tests/test_utils.py::test_echo_writing_to_standard_error PASSED [ 97%] tests/test_utils.py::test_open_file FAILED [ 98%] tests/test_utils.py::test_iter_keepopenfile PASSED [ 99%] tests/test_utils.py::test_iter_lazyfile PASSED [100%] =================================== FAILURES =================================== _______________________________ test_nargs_star ________________________________ runner = def test_nargs_star(runner): @click.command() @click.argument('src', nargs=-1) @click.argument('dst') def copy(src, dst): click.echo('src=%s' % '|'.join(src)) click.echo('dst=%s' % dst) result = runner.invoke(copy, ['foo.txt', 'bar.txt', 'dir']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_arguments.py:15: AssertionError ________________________________ test_nargs_tup ________________________________ runner = def test_nargs_tup(runner): @click.command() @click.argument('name', nargs=1) @click.argument('point', nargs=2, type=click.INT) def copy(name, point): click.echo('name=%s' % name) click.echo('point=%d/%d' % point) result = runner.invoke(copy, ['peter', '1', '2']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_arguments.py:43: AssertionError ___________________________ test_nargs_tup_composite ___________________________ runner = def test_nargs_tup_composite(runner): variations = [ dict(type=(str, int)), dict(type=click.Tuple([str, int])), dict(nargs=2, type=click.Tuple([str, int])), dict(nargs=2, type=(str, int)), ] for opts in variations: @click.command() @click.argument('item', **opts) def copy(item): click.echo('name=%s id=%d' % item) result = runner.invoke(copy, ['peter', '1']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_arguments.py:65: AssertionError ________________________________ test_nargs_err ________________________________ runner = def test_nargs_err(runner): @click.command() @click.argument('x') def copy(x): click.echo(x) result = runner.invoke(copy, ['foo']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_arguments.py:78: AssertionError ________________________________ test_file_args ________________________________ runner = def test_file_args(runner): @click.command() @click.argument('input', type=click.File('rb')) @click.argument('output', type=click.File('wb')) def inout(input, output): while True: chunk = input.read(1024) if not chunk: break output.write(chunk) with runner.isolated_filesystem(): result = runner.invoke(inout, ['-', 'hello.txt'], input='Hey!') assert result.output == '' > assert result.exit_code == 0 E assert -1 == 0 E + where -1 = .exit_code tests/test_arguments.py:100: AssertionError ________________________________ test_path_args ________________________________ runner = def test_path_args(runner): @click.command() @click.argument('input', type=click.Path(dir_okay=False, allow_dash=True)) def foo(input): click.echo(input) result = runner.invoke(foo, ['-']) > assert result.output == '-\n' E AssertionError: assert '' == '-\n' E + - tests/test_arguments.py:116: AssertionError ______________________________ test_file_atomics _______________________________ runner = def test_file_atomics(runner): @click.command() @click.argument('output', type=click.File('wb', atomic=True)) def inout(output): output.write(b'Foo bar baz\n') output.flush() with open(output.name, 'rb') as f: old_content = f.read() assert old_content == b'OLD\n' with runner.isolated_filesystem(): with open('foo.txt', 'wb') as f: f.write(b'OLD\n') result = runner.invoke(inout, ['foo.txt'], input='Hey!', > catch_exceptions=False) tests/test_arguments.py:134: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = cli = , args = ['foo.txt'] input = 'Hey!', env = None, catch_exceptions = False, color = False, extra = {} exc_info = None, out = <_io.BytesIO object at 0x7ffff5645468>, exception = None exit_code = 0, output = b'' def invoke(self, cli, args=None, input=None, env=None, catch_exceptions=True, color=False, **extra): """Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the `extra` keyword arguments are passed to the :meth:`~clickpkg.Command.main` function of the command. This returns a :class:`Result` object. .. versionadded:: 3.0 The ``catch_exceptions`` parameter was added. .. versionchanged:: 3.0 The result object now has an `exc_info` attribute with the traceback if available. .. versionadded:: 4.0 The ``color`` parameter was added. :param cli: the command to invoke :param args: the arguments to invoke :param input: the input data for `sys.stdin`. :param env: the environment overrides. :param catch_exceptions: Whether to catch any other exceptions than ``SystemExit``. :param extra: the keyword arguments to pass to :meth:`main`. :param color: whether the output should contain color codes. The application can still override this explicitly. """ exc_info = None with self.isolation(input=input, env=env, color=color) as out: exception = None exit_code = 0 try: cli.main(args=args or (), > prog_name=self.get_default_prog_name(cli), **extra) click/testing.py:279: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , args = ['foo.txt'] prog_name = 'inout', complete_var = None, standalone_mode = True, extra = {} def main(self, args=None, prog_name=None, complete_var=None, standalone_mode=True, **extra): """This is the way to invoke a script with all the bells and whistles as a command line application. This will always terminate the application after a call. If this is not wanted, ``SystemExit`` needs to be caught. This method is also available by directly calling the instance of a :class:`Command`. .. versionadded:: 3.0 Added the `standalone_mode` flag to control the standalone mode. :param args: the arguments that should be used for parsing. If not provided, ``sys.argv[1:]`` is used. :param prog_name: the program name that should be used. By default the program name is constructed by taking the file name from ``sys.argv[0]``. :param complete_var: the environment variable that controls the bash completion support. The default is ``"__COMPLETE"`` with prog name in uppercase. :param standalone_mode: the default behavior is to invoke the script in standalone mode. Click will then handle exceptions and convert them into error messages and the function will never return but shut down the interpreter. If this is set to `False` they will be propagated to the caller and the return value of this function is the return value of :meth:`invoke`. :param extra: extra keyword arguments are forwarded to the context constructor. See :class:`Context` for more information. """ # If we are in Python 3, we will verify that the environment is # sane at this point of reject further execution to avoid a # broken script. if not PY2: > _verify_python3_env() click/core.py:675: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def _verify_python3_env(): """Ensures that the environment is good for unicode on Python 3.""" if PY2: return try: import locale fs_enc = codecs.lookup(locale.getpreferredencoding()).name except Exception: fs_enc = 'ascii' if fs_enc != 'ascii': return extra = '' if os.name == 'posix': import subprocess rv = subprocess.Popen(['locale', '-a'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0] good_locales = set() has_c_utf8 = False # Make sure we're operating on text here. if isinstance(rv, bytes): rv = rv.decode('ascii', 'replace') for line in rv.splitlines(): locale = line.strip() if locale.lower().endswith(('.utf-8', '.utf8')): good_locales.add(locale) if locale.lower() in ('c.utf8', 'c.utf-8'): has_c_utf8 = True extra += '\n\n' if not good_locales: extra += ( 'Additional information: on this system no suitable UTF-8\n' 'locales were discovered. This most likely requires resolving\n' 'by reconfiguring the locale system.' ) elif has_c_utf8: extra += ( 'This system supports the C.UTF-8 locale which is recommended.\n' 'You might be able to resolve your issue by exporting the\n' 'following environment variables:\n\n' ' export LC_ALL=C.UTF-8\n' ' export LANG=C.UTF-8' ) else: extra += ( 'This system lists a couple of UTF-8 supporting locales that\n' 'you can pick from. The following suitable locales where\n' 'discovered: %s' ) % ', '.join(sorted(good_locales)) bad_locale = None for locale in os.environ.get('LC_ALL'), os.environ.get('LANG'): if locale and locale.lower().endswith(('.utf-8', '.utf8')): bad_locale = locale if locale is not None: break if bad_locale is not None: extra += ( '\n\nClick discovered that you exported a UTF-8 locale\n' 'but the locale system could not pick up from it because\n' 'it does not exist. The exported locale is "%s" but it\n' 'is not supported' ) % bad_locale raise RuntimeError('Click will abort further execution because Python 3 ' 'was configured to use ASCII as encoding for the ' 'environment. Consult http://click.pocoo.org/python3/' > 'for mitigation steps.' + extra) E RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult http://click.pocoo.org/python3/for mitigation steps. E E This system supports the C.UTF-8 locale which is recommended. E You might be able to resolve your issue by exporting the E following environment variables: E E export LC_ALL=C.UTF-8 E export LANG=C.UTF-8 E E Click discovered that you exported a UTF-8 locale E but the locale system could not pick up from it because E it does not exist. The exported locale is "en_US.UTF-8" but it E is not supported click/_unicodefun.py:118: RuntimeError _____________________________ test_stdout_default ______________________________ runner = def test_stdout_default(runner): @click.command() @click.argument('output', type=click.File('w'), default='-') def inout(output): output.write('Foo bar baz\n') output.flush() result = runner.invoke(inout, []) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_arguments.py:149: AssertionError ______________________________ test_nargs_envvar _______________________________ runner = def test_nargs_envvar(runner): @click.command() @click.option('--arg', nargs=2) def cmd(arg): click.echo('|'.join(arg)) result = runner.invoke(cmd, [], auto_envvar_prefix='TEST', env={'TEST_ARG': 'foo bar'}) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_arguments.py:161: AssertionError _______________________________ test_empty_nargs _______________________________ runner = def test_empty_nargs(runner): @click.command() @click.argument('arg', nargs=-1) def cmd(arg): click.echo('arg:' + '|'.join(arg)) result = runner.invoke(cmd, []) > assert result.exit_code == 0 E assert -1 == 0 E + where -1 = .exit_code tests/test_arguments.py:181: AssertionError _______________________________ test_missing_arg _______________________________ runner = def test_missing_arg(runner): @click.command() @click.argument('arg') def cmd(arg): click.echo('arg:' + arg) result = runner.invoke(cmd, []) > assert result.exit_code == 2 E assert -1 == 2 E + where -1 = .exit_code tests/test_arguments.py:201: AssertionError __________________________ test_implicit_non_required __________________________ runner = def test_implicit_non_required(runner): @click.command() @click.argument('f', default='test') def cli(f): click.echo(f) result = runner.invoke(cli, []) > assert result.exit_code == 0 E assert -1 == 0 E + where -1 = .exit_code tests/test_arguments.py:212: AssertionError _______________________________ test_eat_options _______________________________ runner = def test_eat_options(runner): @click.command() @click.option('-f') @click.argument('files', nargs=-1) def cmd(f, files): for filename in files: click.echo(filename) click.echo(f) result = runner.invoke(cmd, ['--', '-foo', 'bar']) > assert result.output.splitlines() == [ '-foo', 'bar', '', ] E AssertionError: assert [] == ['-foo', 'bar', ''] E Right contains more items, first extra item: '-foo' E Full diff: E - [] E + ['-foo', 'bar', ''] tests/test_arguments.py:226: AssertionError ___________________________ test_nargs_star_ordering ___________________________ runner = def test_nargs_star_ordering(runner): @click.command() @click.argument('a', nargs=-1) @click.argument('b') @click.argument('c') def cmd(a, b, c): for arg in (a, b, c): click.echo(arg) result = runner.invoke(cmd, ['a', 'b', 'c']) > assert result.output.splitlines() == [ PY2 and "(u'a',)" or "('a',)", 'b', 'c', ] E assert [] == ["('a',)", 'b', 'c'] E Right contains more items, first extra item: "('a',)" E Full diff: E - [] E + ["('a',)", 'b', 'c'] tests/test_arguments.py:250: AssertionError ___________________ test_nargs_specified_plus_star_ordering ____________________ runner = def test_nargs_specified_plus_star_ordering(runner): @click.command() @click.argument('a', nargs=-1) @click.argument('b') @click.argument('c', nargs=2) def cmd(a, b, c): for arg in (a, b, c): click.echo(arg) result = runner.invoke(cmd, ['a', 'b', 'c', 'd', 'e', 'f']) > assert result.output.splitlines() == [ PY2 and "(u'a', u'b', u'c')" or "('a', 'b', 'c')", 'd', PY2 and "(u'e', u'f')" or "('e', 'f')", ] E assert [] == ["('a', 'b', 'c')", 'd', "('e', 'f')"] E Right contains more items, first extra item: "('a', 'b', 'c')" E Full diff: E - [] E + ["('a', 'b', 'c')", 'd', "('e', 'f')"] tests/test_arguments.py:267: AssertionError ___________________________ test_defaults_for_nargs ____________________________ runner = def test_defaults_for_nargs(runner): @click.command() @click.argument('a', nargs=2, type=int, default=(1, 2)) def cmd(a): x, y = a click.echo(x + y) result = runner.invoke(cmd, []) > assert result.output.strip() == '3' E AssertionError: assert '' == '3' E + 3 tests/test_arguments.py:282: AssertionError ___________________________ test_basic_functionality ___________________________ runner = def test_basic_functionality(runner): @click.command() def cli(): """Hello World!""" click.echo('I EXECUTED') result = runner.invoke(cli, ['--help']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_basic.py:14: AssertionError _______________________________ test_basic_group _______________________________ runner = def test_basic_group(runner): @click.group() def cli(): """This is the root.""" click.echo('ROOT EXECUTED') @cli.command() def subcommand(): """This is a subcommand.""" click.echo('SUBCOMMAND EXECUTED') result = runner.invoke(cli, ['--help']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_basic.py:48: AssertionError ______________________________ test_basic_option _______________________________ runner = def test_basic_option(runner): @click.command() @click.option('--foo', default='no value') def cli(foo): click.echo('FOO:[%s]' % foo) result = runner.invoke(cli, []) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_basic.py:69: AssertionError _______________________________ test_int_option ________________________________ runner = def test_int_option(runner): @click.command() @click.option('--foo', default=42) def cli(foo): click.echo('FOO:[%s]' % (foo * 2)) result = runner.invoke(cli, []) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_basic.py:96: AssertionError _______________________________ test_uuid_option _______________________________ runner = def test_uuid_option(runner): @click.command() @click.option('--u', default='ba122011-349f-423b-873b-9d6a79c688ab', type=click.UUID) def cli(u): assert type(u) is uuid.UUID click.echo('U:[%s]' % u) result = runner.invoke(cli, []) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_basic.py:118: AssertionError ______________________________ test_float_option _______________________________ runner = def test_float_option(runner): @click.command() @click.option('--foo', default=42, type=click.FLOAT) def cli(foo): assert type(foo) is float click.echo('FOO:[%s]' % foo) result = runner.invoke(cli, []) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_basic.py:139: AssertionError _____________________________ test_boolean_option ______________________________ runner = def test_boolean_option(runner): for default in True, False: @click.command() @click.option('--with-foo/--without-foo', default=default) def cli(with_foo): click.echo(with_foo) result = runner.invoke(cli, ['--with-foo']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_basic.py:160: AssertionError _______________________________ test_file_option _______________________________ runner = def test_file_option(runner): @click.command() @click.option('--file', type=click.File('w')) def input(file): file.write('Hello World!\n') @click.command() @click.option('--file', type=click.File('r')) def output(file): click.echo(file.read()) with runner.isolated_filesystem(): result_in = runner.invoke(input, ['--file=example.txt']) result_out = runner.invoke(output, ['--file=example.txt']) > assert not result_in.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_basic.py:198: AssertionError _____________________________ test_file_lazy_mode ______________________________ runner = def test_file_lazy_mode(runner): do_io = False @click.command() @click.option('--file', type=click.File('w')) def input(file): if do_io: file.write('Hello World!\n') @click.command() @click.option('--file', type=click.File('r')) def output(file): pass with runner.isolated_filesystem(): os.mkdir('example.txt') do_io = True result_in = runner.invoke(input, ['--file=example.txt']) > assert result_in.exit_code == 1 E assert -1 == 1 E + where -1 = .exit_code tests/test_basic.py:223: AssertionError _______________________________ test_path_option _______________________________ runner = def test_path_option(runner): @click.command() @click.option('-O', type=click.Path(file_okay=False, exists=True, writable=True)) def write_to_dir(o): with open(os.path.join(o, 'foo.txt'), 'wb') as f: f.write(b'meh\n') with runner.isolated_filesystem(): os.mkdir('test') result = runner.invoke(write_to_dir, ['-O', 'test']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_basic.py:257: AssertionError ______________________________ test_choice_option ______________________________ runner = def test_choice_option(runner): @click.command() @click.option('--method', type=click.Choice(['foo', 'bar', 'baz'])) def cli(method): click.echo(method) result = runner.invoke(cli, ['--method=foo']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_basic.py:301: AssertionError ____________________________ test_int_range_option _____________________________ runner = def test_int_range_option(runner): @click.command() @click.option('--x', type=click.IntRange(0, 5)) def cli(x): click.echo(x) result = runner.invoke(cli, ['--x=5']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_basic.py:320: AssertionError _____________________________ test_required_option _____________________________ runner = def test_required_option(runner): @click.command() @click.option('--foo', required=True) def cli(foo): click.echo(foo) result = runner.invoke(cli, []) > assert result.exit_code == 2 E assert -1 == 2 E + where -1 = .exit_code tests/test_basic.py:353: AssertionError ____________________________ test_evaluation_order _____________________________ runner = def test_evaluation_order(runner): called = [] def memo(ctx, value): called.append(value) return value @click.command() @click.option('--missing', default='missing', is_eager=False, callback=memo) @click.option('--eager-flag1', flag_value='eager1', is_eager=True, callback=memo) @click.option('--eager-flag2', flag_value='eager2', is_eager=True, callback=memo) @click.option('--eager-flag3', flag_value='eager3', is_eager=True, callback=memo) @click.option('--normal-flag1', flag_value='normal1', is_eager=False, callback=memo) @click.option('--normal-flag2', flag_value='normal2', is_eager=False, callback=memo) @click.option('--normal-flag3', flag_value='normal3', is_eager=False, callback=memo) def cli(**x): pass result = runner.invoke(cli, ['--eager-flag2', '--eager-flag1', '--normal-flag2', '--eager-flag3', '--normal-flag3', '--normal-flag3', '--normal-flag1', '--normal-flag1']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_basic.py:390: AssertionError _____________________________ test_basic_chaining ______________________________ runner = def test_basic_chaining(runner): @click.group(chain=True) def cli(): pass @cli.command('sdist') def sdist(): click.echo('sdist called') @cli.command('bdist') def bdist(): click.echo('bdist called') result = runner.invoke(cli, ['bdist', 'sdist', 'bdist']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_chain.py:27: AssertionError ______________________________ test_chaining_help ______________________________ runner = def test_chaining_help(runner): @click.group(chain=True) def cli(): """ROOT HELP""" pass @cli.command('sdist') def sdist(): """SDIST HELP""" click.echo('sdist called') @cli.command('bdist') def bdist(): """BDIST HELP""" click.echo('bdist called') result = runner.invoke(cli, ['--help']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_chain.py:52: AssertionError __________________________ test_chaining_with_options __________________________ runner = def test_chaining_with_options(runner): @click.group(chain=True) def cli(): pass @cli.command('sdist') @click.option('--format') def sdist(format): click.echo('sdist called %s' % format) @cli.command('bdist') @click.option('--format') def bdist(format): click.echo('bdist called %s' % format) result = runner.invoke(cli, ['bdist', '--format=1', 'sdist', '--format=2']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_chain.py:85: AssertionError _________________________ test_chaining_with_arguments _________________________ runner = def test_chaining_with_arguments(runner): @click.group(chain=True) def cli(): pass @cli.command('sdist') @click.argument('format') def sdist(format): click.echo('sdist called %s' % format) @cli.command('bdist') @click.argument('format') def bdist(format): click.echo('bdist called %s' % format) result = runner.invoke(cli, ['bdist', '1', 'sdist', '2']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_chain.py:108: AssertionError ________________________________ test_pipeline _________________________________ runner = def test_pipeline(runner): @click.group(chain=True, invoke_without_command=True) @click.option('-i', '--input', type=click.File('r')) def cli(input): pass @cli.resultcallback() def process_pipeline(processors, input): iterator = (x.rstrip('\r\n') for x in input) for processor in processors: iterator = processor(iterator) for item in iterator: click.echo(item) @cli.command('uppercase') def make_uppercase(): def processor(iterator): for line in iterator: yield line.upper() return processor @cli.command('strip') def make_strip(): def processor(iterator): for line in iterator: yield line.strip() return processor result = runner.invoke(cli, ['-i', '-'], input='foo\nbar') > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_chain.py:144: AssertionError _____________________________ test_args_and_chain ______________________________ runner = def test_args_and_chain(runner): @click.group(chain=True) def cli(): debug() @cli.command() def a(): debug() @cli.command() def b(): debug() @cli.command() def c(): debug() result = runner.invoke(cli, ['a', 'b', 'c']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_chain.py:184: AssertionError ________________________ test_multicommand_arg_behavior ________________________ runner = def test_multicommand_arg_behavior(runner): with pytest.raises(RuntimeError): @click.group(chain=True) @click.argument('forbidden', required=False) def bad_cli(): pass with pytest.raises(RuntimeError): @click.group(chain=True) @click.argument('forbidden', nargs=-1) def bad_cli2(): pass @click.group(chain=True) @click.argument('arg') def cli(arg): click.echo('cli:%s' % arg) @cli.command() def a(): click.echo('a') result = runner.invoke(cli, ['foo', 'a']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_chain.py:216: AssertionError __________________________ test_other_command_invoke ___________________________ runner = def test_other_command_invoke(runner): @click.command() @click.pass_context def cli(ctx): return ctx.invoke(other_cmd, arg=42) @click.command() @click.argument('arg', type=click.INT) def other_cmd(arg): click.echo(arg) result = runner.invoke(cli, []) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_commands.py:18: AssertionError __________________________ test_other_command_forward __________________________ runner = def test_other_command_forward(runner): cli = click.Group() @cli.command() @click.option('--count', default=1) def test(count): click.echo('Count: %d' % count) @cli.command() @click.option('--count', default=1) @click.pass_context def dist(ctx, count): ctx.forward(test) ctx.invoke(test, count=42) result = runner.invoke(cli, ['dist']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_commands.py:38: AssertionError _____________________________ test_auto_shorthelp ______________________________ runner = def test_auto_shorthelp(runner): @click.group() def cli(): pass @cli.command() def short(): """This is a short text.""" @cli.command() def special_chars(): """Login and store the token in ~/.netrc.""" @cli.command() def long(): """This is a long text that is too long to show as short help and will be truncated instead.""" result = runner.invoke(cli, ['--help']) > assert re.search( r'Commands:\n\s+' r'long\s+This is a long text that is too long to show\.\.\.\n\s+' r'short\s+This is a short text\.\n\s+' r'special_chars\s+Login and store the token in ~/.netrc\.\s*', result.output) is not None E assert None is not None E + where None = ('Commands:\\n\\s+long\\s+This is a long text that is too long to show\\.\\.\\.\\n\\s+short\\s+This is a short text\\.\\n\\s+special_chars\\s+Login and store the token in ~/.netrc\\.\\s*', '') E + where = re.search E + and '' = .output tests/test_commands.py:61: AssertionError ______________________________ test_default_maps _______________________________ runner = def test_default_maps(runner): @click.group() def cli(): pass @cli.command() @click.option('--name', default='normal') def foo(name): click.echo(name) result = runner.invoke(cli, ['foo'], default_map={ 'foo': {'name': 'changed'} }) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_commands.py:83: AssertionError _____________________________ test_group_with_args _____________________________ runner = def test_group_with_args(runner): @click.group() @click.argument('obj') def cli(obj): click.echo('obj=%s' % obj) @cli.command() def move(): click.echo('move') result = runner.invoke(cli, []) > assert result.exit_code == 0 E assert -1 == 0 E + where -1 = .exit_code tests/test_commands.py:98: AssertionError ______________________________ test_base_command _______________________________ runner = def test_base_command(runner): import optparse @click.group() def cli(): pass class OptParseCommand(click.BaseCommand): def __init__(self, name, parser, callback): click.BaseCommand.__init__(self, name) self.parser = parser self.callback = callback def parse_args(self, ctx, args): try: opts, args = parser.parse_args(args) except Exception as e: ctx.fail(str(e)) ctx.args = args ctx.params = vars(opts) def get_usage(self, ctx): return self.parser.get_usage() def get_help(self, ctx): return self.parser.format_help() def invoke(self, ctx): ctx.invoke(self.callback, ctx.args, **ctx.params) parser = optparse.OptionParser(usage='Usage: foo test [OPTIONS]') parser.add_option("-f", "--file", dest="filename", help="write report to FILE", metavar="FILE") parser.add_option("-q", "--quiet", action="store_false", dest="verbose", default=True, help="don't print status messages to stdout") def test_callback(args, filename, verbose): click.echo(' '.join(args)) click.echo(filename) click.echo(verbose) cli.add_command(OptParseCommand('test', parser, test_callback)) result = runner.invoke(cli, ['test', '-f', 'test.txt', '-q', 'whatever.txt', 'whateverelse.txt']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_commands.py:160: AssertionError ___________________________ test_object_propagation ____________________________ runner = def test_object_propagation(runner): for chain in False, True: @click.group(chain=chain) @click.option('--debug/--no-debug', default=False) @click.pass_context def cli(ctx, debug): if ctx.obj is None: ctx.obj = {} ctx.obj['DEBUG'] = debug @cli.command() @click.pass_context def sync(ctx): click.echo('Debug is %s' % (ctx.obj['DEBUG'] and 'on' or 'off')) result = runner.invoke(cli, ['sync']) > assert result.exception is None E assert RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) is None E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_commands.py:195: AssertionError ___________________ test_other_command_invoke_with_defaults ____________________ runner = def test_other_command_invoke_with_defaults(runner): @click.command() @click.pass_context def cli(ctx): return ctx.invoke(other_cmd) @click.command() @click.option('--foo', type=click.INT, default=42) @click.pass_context def other_cmd(ctx, foo): assert ctx.info_name == 'other_cmd' click.echo(foo) result = runner.invoke(cli, []) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_commands.py:213: AssertionError ___________________________ test_invoked_subcommand ____________________________ runner = def test_invoked_subcommand(runner): @click.group(invoke_without_command=True) @click.pass_context def cli(ctx): if ctx.invoked_subcommand is None: click.echo('no subcommand, use default') ctx.invoke(sync) else: click.echo('invoke subcommand') @cli.command() def sync(): click.echo('in subcommand') result = runner.invoke(cli, ['sync']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_commands.py:232: AssertionError ___________________________ test_unprocessed_options ___________________________ runner = def test_unprocessed_options(runner): @click.command(context_settings=dict( ignore_unknown_options=True )) @click.argument('args', nargs=-1, type=click.UNPROCESSED) @click.option('--verbose', '-v', count=True) def cli(verbose, args): click.echo('Verbosity: %s' % verbose) click.echo('Args: %s' % '|'.join(args)) result = runner.invoke(cli, ['-foo', '-vvvvx', '--muhaha', 'x', 'y', '-x']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_commands.py:251: AssertionError ____________________________ test_legacy_callbacks _____________________________ runner = def test_legacy_callbacks(runner): def legacy_callback(ctx, value): return value.upper() @click.command() @click.option('--foo', callback=legacy_callback) def cli(foo): click.echo(foo) with pytest.warns(Warning) as records: > result = runner.invoke(cli, ['--foo', 'wat']) E Failed: DID NOT WARN. No warnings of type (,) was emitted. The list of emitted warnings is: []. tests/test_compat.py:17: Failed _________________________ test_ensure_context_objects __________________________ runner = def test_ensure_context_objects(runner): class Foo(object): def __init__(self): self.title = 'default' pass_foo = click.make_pass_decorator(Foo, ensure=True) @click.group() @pass_foo def cli(foo): pass @cli.command() @pass_foo def test(foo): click.echo(foo.title) result = runner.invoke(cli, ['test']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_context.py:23: AssertionError ___________________________ test_get_context_objects ___________________________ runner = def test_get_context_objects(runner): class Foo(object): def __init__(self): self.title = 'default' pass_foo = click.make_pass_decorator(Foo, ensure=True) @click.group() @click.pass_context def cli(ctx): ctx.obj = Foo() ctx.obj.title = 'test' @cli.command() @pass_foo def test(foo): click.echo(foo.title) result = runner.invoke(cli, ['test']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_context.py:46: AssertionError _____________________ test_get_context_objects_no_ensuring _____________________ runner = def test_get_context_objects_no_ensuring(runner): class Foo(object): def __init__(self): self.title = 'default' pass_foo = click.make_pass_decorator(Foo) @click.group() @click.pass_context def cli(ctx): ctx.obj = Foo() ctx.obj.title = 'test' @cli.command() @pass_foo def test(foo): click.echo(foo.title) result = runner.invoke(cli, ['test']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_context.py:69: AssertionError _______________________ test_get_context_objects_missing _______________________ runner = def test_get_context_objects_missing(runner): class Foo(object): pass pass_foo = click.make_pass_decorator(Foo) @click.group() @click.pass_context def cli(ctx): pass @cli.command() @pass_foo def test(foo): click.echo(foo.title) result = runner.invoke(cli, ['test']) assert result.exception is not None assert isinstance(result.exception, RuntimeError) > assert "Managed to invoke callback without a context object " \ "of type 'Foo' existing" in str(result.exception) E assert "Managed to invoke callback without a context object of type 'Foo' existing" in 'Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Con...m could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported' E + where 'Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Con...m could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported' = str(RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',)) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_context.py:92: AssertionError _______________________________ test_multi_enter _______________________________ runner = def test_multi_enter(runner): called = [] @click.command() @click.pass_context def cli(ctx): def callback(): called.append(True) ctx.call_on_close(callback) with ctx: pass assert not called result = runner.invoke(cli, []) > assert result.exception is None E assert RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) is None E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_context.py:111: AssertionError __________________________ test_global_context_object __________________________ runner = def test_global_context_object(runner): @click.command() @click.pass_context def cli(ctx): assert click.get_current_context() is ctx ctx.obj = 'FOOBAR' assert click.get_current_context().obj == 'FOOBAR' assert click.get_current_context(silent=True) is None > runner.invoke(cli, [], catch_exceptions=False) tests/test_context.py:124: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = cli = , args = [], input = None env = None, catch_exceptions = False, color = False, extra = {}, exc_info = None out = <_io.BytesIO object at 0x7ffff52ac468>, exception = None, exit_code = 0 output = b'' def invoke(self, cli, args=None, input=None, env=None, catch_exceptions=True, color=False, **extra): """Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the `extra` keyword arguments are passed to the :meth:`~clickpkg.Command.main` function of the command. This returns a :class:`Result` object. .. versionadded:: 3.0 The ``catch_exceptions`` parameter was added. .. versionchanged:: 3.0 The result object now has an `exc_info` attribute with the traceback if available. .. versionadded:: 4.0 The ``color`` parameter was added. :param cli: the command to invoke :param args: the arguments to invoke :param input: the input data for `sys.stdin`. :param env: the environment overrides. :param catch_exceptions: Whether to catch any other exceptions than ``SystemExit``. :param extra: the keyword arguments to pass to :meth:`main`. :param color: whether the output should contain color codes. The application can still override this explicitly. """ exc_info = None with self.isolation(input=input, env=env, color=color) as out: exception = None exit_code = 0 try: cli.main(args=args or (), > prog_name=self.get_default_prog_name(cli), **extra) click/testing.py:279: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , args = () prog_name = 'cli', complete_var = None, standalone_mode = True, extra = {} def main(self, args=None, prog_name=None, complete_var=None, standalone_mode=True, **extra): """This is the way to invoke a script with all the bells and whistles as a command line application. This will always terminate the application after a call. If this is not wanted, ``SystemExit`` needs to be caught. This method is also available by directly calling the instance of a :class:`Command`. .. versionadded:: 3.0 Added the `standalone_mode` flag to control the standalone mode. :param args: the arguments that should be used for parsing. If not provided, ``sys.argv[1:]`` is used. :param prog_name: the program name that should be used. By default the program name is constructed by taking the file name from ``sys.argv[0]``. :param complete_var: the environment variable that controls the bash completion support. The default is ``"__COMPLETE"`` with prog name in uppercase. :param standalone_mode: the default behavior is to invoke the script in standalone mode. Click will then handle exceptions and convert them into error messages and the function will never return but shut down the interpreter. If this is set to `False` they will be propagated to the caller and the return value of this function is the return value of :meth:`invoke`. :param extra: extra keyword arguments are forwarded to the context constructor. See :class:`Context` for more information. """ # If we are in Python 3, we will verify that the environment is # sane at this point of reject further execution to avoid a # broken script. if not PY2: > _verify_python3_env() click/core.py:675: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def _verify_python3_env(): """Ensures that the environment is good for unicode on Python 3.""" if PY2: return try: import locale fs_enc = codecs.lookup(locale.getpreferredencoding()).name except Exception: fs_enc = 'ascii' if fs_enc != 'ascii': return extra = '' if os.name == 'posix': import subprocess rv = subprocess.Popen(['locale', '-a'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0] good_locales = set() has_c_utf8 = False # Make sure we're operating on text here. if isinstance(rv, bytes): rv = rv.decode('ascii', 'replace') for line in rv.splitlines(): locale = line.strip() if locale.lower().endswith(('.utf-8', '.utf8')): good_locales.add(locale) if locale.lower() in ('c.utf8', 'c.utf-8'): has_c_utf8 = True extra += '\n\n' if not good_locales: extra += ( 'Additional information: on this system no suitable UTF-8\n' 'locales were discovered. This most likely requires resolving\n' 'by reconfiguring the locale system.' ) elif has_c_utf8: extra += ( 'This system supports the C.UTF-8 locale which is recommended.\n' 'You might be able to resolve your issue by exporting the\n' 'following environment variables:\n\n' ' export LC_ALL=C.UTF-8\n' ' export LANG=C.UTF-8' ) else: extra += ( 'This system lists a couple of UTF-8 supporting locales that\n' 'you can pick from. The following suitable locales where\n' 'discovered: %s' ) % ', '.join(sorted(good_locales)) bad_locale = None for locale in os.environ.get('LC_ALL'), os.environ.get('LANG'): if locale and locale.lower().endswith(('.utf-8', '.utf8')): bad_locale = locale if locale is not None: break if bad_locale is not None: extra += ( '\n\nClick discovered that you exported a UTF-8 locale\n' 'but the locale system could not pick up from it because\n' 'it does not exist. The exported locale is "%s" but it\n' 'is not supported' ) % bad_locale raise RuntimeError('Click will abort further execution because Python 3 ' 'was configured to use ASCII as encoding for the ' 'environment. Consult http://click.pocoo.org/python3/' > 'for mitigation steps.' + extra) E RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult http://click.pocoo.org/python3/for mitigation steps. E E This system supports the C.UTF-8 locale which is recommended. E You might be able to resolve your issue by exporting the E following environment variables: E E export LC_ALL=C.UTF-8 E export LANG=C.UTF-8 E E Click discovered that you exported a UTF-8 locale E but the locale system could not pick up from it because E it does not exist. The exported locale is "en_US.UTF-8" but it E is not supported click/_unicodefun.py:118: RuntimeError ______________________________ test_context_meta _______________________________ runner = def test_context_meta(runner): LANG_KEY = __name__ + '.lang' def set_language(value): click.get_current_context().meta[LANG_KEY] = value def get_language(): return click.get_current_context().meta.get(LANG_KEY, 'en_US') @click.command() @click.pass_context def cli(ctx): assert get_language() == 'en_US' set_language('de_DE') assert get_language() == 'de_DE' > runner.invoke(cli, [], catch_exceptions=False) tests/test_context.py:144: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = cli = , args = [], input = None env = None, catch_exceptions = False, color = False, extra = {}, exc_info = None out = <_io.BytesIO object at 0x7ffff53b2360>, exception = None, exit_code = 0 output = b'' def invoke(self, cli, args=None, input=None, env=None, catch_exceptions=True, color=False, **extra): """Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the `extra` keyword arguments are passed to the :meth:`~clickpkg.Command.main` function of the command. This returns a :class:`Result` object. .. versionadded:: 3.0 The ``catch_exceptions`` parameter was added. .. versionchanged:: 3.0 The result object now has an `exc_info` attribute with the traceback if available. .. versionadded:: 4.0 The ``color`` parameter was added. :param cli: the command to invoke :param args: the arguments to invoke :param input: the input data for `sys.stdin`. :param env: the environment overrides. :param catch_exceptions: Whether to catch any other exceptions than ``SystemExit``. :param extra: the keyword arguments to pass to :meth:`main`. :param color: whether the output should contain color codes. The application can still override this explicitly. """ exc_info = None with self.isolation(input=input, env=env, color=color) as out: exception = None exit_code = 0 try: cli.main(args=args or (), > prog_name=self.get_default_prog_name(cli), **extra) click/testing.py:279: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , args = () prog_name = 'cli', complete_var = None, standalone_mode = True, extra = {} def main(self, args=None, prog_name=None, complete_var=None, standalone_mode=True, **extra): """This is the way to invoke a script with all the bells and whistles as a command line application. This will always terminate the application after a call. If this is not wanted, ``SystemExit`` needs to be caught. This method is also available by directly calling the instance of a :class:`Command`. .. versionadded:: 3.0 Added the `standalone_mode` flag to control the standalone mode. :param args: the arguments that should be used for parsing. If not provided, ``sys.argv[1:]`` is used. :param prog_name: the program name that should be used. By default the program name is constructed by taking the file name from ``sys.argv[0]``. :param complete_var: the environment variable that controls the bash completion support. The default is ``"__COMPLETE"`` with prog name in uppercase. :param standalone_mode: the default behavior is to invoke the script in standalone mode. Click will then handle exceptions and convert them into error messages and the function will never return but shut down the interpreter. If this is set to `False` they will be propagated to the caller and the return value of this function is the return value of :meth:`invoke`. :param extra: extra keyword arguments are forwarded to the context constructor. See :class:`Context` for more information. """ # If we are in Python 3, we will verify that the environment is # sane at this point of reject further execution to avoid a # broken script. if not PY2: > _verify_python3_env() click/core.py:675: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def _verify_python3_env(): """Ensures that the environment is good for unicode on Python 3.""" if PY2: return try: import locale fs_enc = codecs.lookup(locale.getpreferredencoding()).name except Exception: fs_enc = 'ascii' if fs_enc != 'ascii': return extra = '' if os.name == 'posix': import subprocess rv = subprocess.Popen(['locale', '-a'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0] good_locales = set() has_c_utf8 = False # Make sure we're operating on text here. if isinstance(rv, bytes): rv = rv.decode('ascii', 'replace') for line in rv.splitlines(): locale = line.strip() if locale.lower().endswith(('.utf-8', '.utf8')): good_locales.add(locale) if locale.lower() in ('c.utf8', 'c.utf-8'): has_c_utf8 = True extra += '\n\n' if not good_locales: extra += ( 'Additional information: on this system no suitable UTF-8\n' 'locales were discovered. This most likely requires resolving\n' 'by reconfiguring the locale system.' ) elif has_c_utf8: extra += ( 'This system supports the C.UTF-8 locale which is recommended.\n' 'You might be able to resolve your issue by exporting the\n' 'following environment variables:\n\n' ' export LC_ALL=C.UTF-8\n' ' export LANG=C.UTF-8' ) else: extra += ( 'This system lists a couple of UTF-8 supporting locales that\n' 'you can pick from. The following suitable locales where\n' 'discovered: %s' ) % ', '.join(sorted(good_locales)) bad_locale = None for locale in os.environ.get('LC_ALL'), os.environ.get('LANG'): if locale and locale.lower().endswith(('.utf-8', '.utf8')): bad_locale = locale if locale is not None: break if bad_locale is not None: extra += ( '\n\nClick discovered that you exported a UTF-8 locale\n' 'but the locale system could not pick up from it because\n' 'it does not exist. The exported locale is "%s" but it\n' 'is not supported' ) % bad_locale raise RuntimeError('Click will abort further execution because Python 3 ' 'was configured to use ASCII as encoding for the ' 'environment. Consult http://click.pocoo.org/python3/' > 'for mitigation steps.' + extra) E RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult http://click.pocoo.org/python3/for mitigation steps. E E This system supports the C.UTF-8 locale which is recommended. E You might be able to resolve your issue by exporting the E following environment variables: E E export LC_ALL=C.UTF-8 E export LANG=C.UTF-8 E E Click discovered that you exported a UTF-8 locale E but the locale system could not pick up from it because E it does not exist. The exported locale is "en_US.UTF-8" but it E is not supported click/_unicodefun.py:118: RuntimeError ________________________________ test_pass_obj _________________________________ runner = def test_pass_obj(runner): @click.group() @click.pass_context def cli(ctx): ctx.obj = 'test' @cli.command() @click.pass_obj def test(obj): click.echo(obj) result = runner.invoke(cli, ['test']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_context.py:185: AssertionError ____________________________ test_close_before_pop _____________________________ runner = def test_close_before_pop(runner): called = [] @click.command() @click.pass_context def cli(ctx): ctx.obj = 'test' @ctx.call_on_close def foo(): assert click.get_current_context().obj == 'test' called.append(True) click.echo('aha!') result = runner.invoke(cli, []) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_context.py:203: AssertionError _____________________________ test_basic_defaults ______________________________ runner = def test_basic_defaults(runner): @click.command() @click.option('--foo', default=42, type=click.FLOAT) def cli(foo): assert type(foo) is float click.echo('FOO:[%s]' % foo) result = runner.invoke(cli, []) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_defaults.py:12: AssertionError ____________________________ test_multiple_defaults ____________________________ runner = def test_multiple_defaults(runner): @click.command() @click.option('--foo', default=[23, 42], type=click.FLOAT, multiple=True) def cli(foo): for item in foo: assert type(item) is float click.echo(item) result = runner.invoke(cli, []) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_defaults.py:26: AssertionError ___________________________ test_nargs_plus_multiple ___________________________ runner = def test_nargs_plus_multiple(runner): @click.command() @click.option('--arg', default=((1, 2), (3, 4)), nargs=2, multiple=True, type=click.INT) def cli(arg): for item in arg: click.echo('<%d|%d>' % item) result = runner.invoke(cli, []) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_defaults.py:42: AssertionError ___________________________ test_basic_functionality ___________________________ runner = def test_basic_functionality(runner): @click.command() def cli(): """First paragraph. This is a very long second paragraph and not correctly wrapped but it will be rewrapped. \b This is a paragraph without rewrapping. \b 1 2 3 And this is a paragraph that will be rewrapped again. """ result = runner.invoke(cli, ['--help'], terminal_width=60) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_formatting.py:29: AssertionError ______________________ test_wrapping_long_options_strings ______________________ runner = def test_wrapping_long_options_strings(runner): @click.group() def cli(): """Top level command """ @cli.group() def a_very_long(): """Second level """ @a_very_long.command() @click.argument('first') @click.argument('second') @click.argument('third') @click.argument('fourth') @click.argument('fifth') @click.argument('sixth') def command(): """A command. """ # 54 is chosen as a length where the second line is one character # longer than the maximum length. result = runner.invoke(cli, ['a_very_long', 'command', '--help'], terminal_width=54) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_formatting.py:79: AssertionError _______________________ test_wrapping_long_command_name ________________________ runner = def test_wrapping_long_command_name(runner): @click.group() def cli(): """Top level command """ @cli.group() def a_very_very_very_long(): """Second level """ @a_very_very_very_long.command() @click.argument('first') @click.argument('second') @click.argument('third') @click.argument('fourth') @click.argument('fifth') @click.argument('sixth') def command(): """A command. """ result = runner.invoke(cli, ['a_very_very_very_long', 'command', '--help'], terminal_width=54) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_formatting.py:116: AssertionError _______________________ test_formatting_empty_help_lines _______________________ runner = def test_formatting_empty_help_lines(runner): @click.command() def cli(): """Top level command """ result = runner.invoke(cli, ['--help']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_formatting.py:137: AssertionError __________________________ test_option_normalization ___________________________ runner = def test_option_normalization(runner): @click.command(context_settings=CONTEXT_SETTINGS) @click.option('--foo') @click.option('-x') def cli(foo, x): click.echo(foo) click.echo(x) result = runner.invoke(cli, ['--FOO', '42', '-X', 23]) > assert result.output == '42\n23\n' E AssertionError: assert '' == '42\n23\n' E + 42 E + 23 tests/test_normalization.py:16: AssertionError __________________________ test_choice_normalization ___________________________ runner = def test_choice_normalization(runner): @click.command(context_settings=CONTEXT_SETTINGS) @click.option('--choice', type=click.Choice(['Foo', 'Bar'])) def cli(choice): click.echo('Foo') result = runner.invoke(cli, ['--CHOICE', 'FOO']) > assert result.output == 'Foo\n' E AssertionError: assert '' == 'Foo\n' E + Foo tests/test_normalization.py:26: AssertionError __________________________ test_command_normalization __________________________ runner = def test_command_normalization(runner): @click.group(context_settings=CONTEXT_SETTINGS) def cli(): pass @cli.command() def foo(): click.echo('here!') result = runner.invoke(cli, ['FOO']) > assert result.output == 'here!\n' E AssertionError: assert '' == 'here!\n' E + here! tests/test_normalization.py:39: AssertionError ________________________________ test_prefixes _________________________________ runner = def test_prefixes(runner): @click.command() @click.option('++foo', is_flag=True, help='das foo') @click.option('--bar', is_flag=True, help='das bar') def cli(foo, bar): click.echo('foo=%s bar=%s' % (foo, bar)) result = runner.invoke(cli, ['++foo', '--bar']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_options.py:18: AssertionError ________________________ test_nargs_tup_composite_mult _________________________ runner = def test_nargs_tup_composite_mult(runner): @click.command() @click.option('--item', type=(str, int), multiple=True) def copy(item): for item in item: click.echo('name=%s id=%d' % item) result = runner.invoke(copy, ['--item', 'peter', '1', '--item', 'max', '2']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_options.py:59: AssertionError ________________________________ test_counting _________________________________ runner = def test_counting(runner): @click.command() @click.option('-v', count=True, help='Verbosity', type=click.IntRange(0, 3)) def cli(v): click.echo('verbosity=%d' % v) result = runner.invoke(cli, ['-vvv']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_options.py:74: AssertionError _________________________ test_unknown_options[--foo] __________________________ runner = unknown_flag = '--foo' @pytest.mark.parametrize('unknown_flag', ['--foo', '-f']) def test_unknown_options(runner, unknown_flag): @click.command() def cli(): pass result = runner.invoke(cli, [unknown_flag]) assert result.exception > assert 'no such option: {0}'.format(unknown_flag) in result.output E assert 'no such option: --foo' in '' E + where 'no such option: --foo' = ('--foo') E + where = 'no such option: {0}'.format E + and '' = .output tests/test_options.py:98: AssertionError ___________________________ test_unknown_options[-f] ___________________________ runner = , unknown_flag = '-f' @pytest.mark.parametrize('unknown_flag', ['--foo', '-f']) def test_unknown_options(runner, unknown_flag): @click.command() def cli(): pass result = runner.invoke(cli, [unknown_flag]) assert result.exception > assert 'no such option: {0}'.format(unknown_flag) in result.output E assert 'no such option: -f' in '' E + where 'no such option: -f' = ('-f') E + where = 'no such option: {0}'.format E + and '' = .output tests/test_options.py:98: AssertionError ____________________________ test_multiple_required ____________________________ runner = def test_multiple_required(runner): @click.command() @click.option('-m', '--message', multiple=True, required=True) def cli(message): click.echo('\n'.join(message)) result = runner.invoke(cli, ['-m', 'foo', '-mbar']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_options.py:108: AssertionError _____________________________ test_multiple_envvar _____________________________ runner = def test_multiple_envvar(runner): @click.command() @click.option('--arg', multiple=True) def cmd(arg): click.echo('|'.join(arg)) result = runner.invoke(cmd, [], auto_envvar_prefix='TEST', env={'TEST_ARG': 'foo bar baz'}) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_options.py:124: AssertionError __________________________ test_multiple_default_help __________________________ runner = def test_multiple_default_help(runner): @click.command() @click.option('--arg1', multiple=True, default=('foo', 'bar'), show_default=True) @click.option('--arg2', multiple=True, default=(1, 2), type=int, show_default=True) def cmd(arg, arg2): pass result = runner.invoke(cmd, ['--help']) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_options.py:157: AssertionError __________________________ test_multiple_default_type __________________________ runner = def test_multiple_default_type(runner): @click.command() @click.option('--arg1', multiple=True, default=('foo', 'bar')) @click.option('--arg2', multiple=True, default=(1, 'a')) def cmd(arg1, arg2): assert all(isinstance(e[0], text_type) for e in arg1) assert all(isinstance(e[1], text_type) for e in arg1) assert all(isinstance(e[0], int) for e in arg2) assert all(isinstance(e[1], text_type) for e in arg2) result = runner.invoke(cmd, '--arg1 a b --arg1 test 1 --arg2 2 ' 'two --arg2 4 four'.split()) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_options.py:175: AssertionError ______________________________ test_nargs_envvar _______________________________ runner = def test_nargs_envvar(runner): @click.command() @click.option('--arg', nargs=2) def cmd(arg): click.echo('|'.join(arg)) result = runner.invoke(cmd, [], auto_envvar_prefix='TEST', env={'TEST_ARG': 'foo bar'}) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_options.py:186: AssertionError ____________________________ test_custom_validation ____________________________ runner = def test_custom_validation(runner): def validate_pos_int(ctx, value): if value < 0: raise click.BadParameter('Value needs to be positive') return value @click.command() @click.option('--foo', callback=validate_pos_int, default=1) def cmd(foo): click.echo(foo) result = runner.invoke(cmd, ['--foo', '-1']) > assert 'Invalid value for "--foo": Value needs to be positive' \ in result.output E assert 'Invalid value for "--foo": Value needs to be positive' in '' E + where '' = .output tests/test_options.py:213: AssertionError ____________________________ test_winstyle_options _____________________________ runner = def test_winstyle_options(runner): @click.command() @click.option('/debug;/no-debug', help='Enables or disables debug mode.') def cmd(debug): click.echo(debug) result = runner.invoke(cmd, ['/debug'], help_option_names=['/?']) > assert result.output == 'True\n' E AssertionError: assert '' == 'True\n' E + True tests/test_options.py:227: AssertionError _____________________________ test_legacy_options ______________________________ runner = def test_legacy_options(runner): @click.command() @click.option('-whatever') def cmd(whatever): click.echo(whatever) result = runner.invoke(cmd, ['-whatever', '42']) > assert result.output == '42\n' E AssertionError: assert '' == '42\n' E + 42 tests/test_options.py:244: AssertionError _____________________________ test_missing_choice ______________________________ runner = def test_missing_choice(runner): @click.command() @click.option('--foo', type=click.Choice(['foo', 'bar']), required=True) def cmd(foo): click.echo(foo) result = runner.invoke(cmd) > assert result.exit_code == 2 E assert -1 == 2 E + where -1 = .exit_code tests/test_options.py:257: AssertionError _____________________________ test_multiline_help ______________________________ runner = def test_multiline_help(runner): @click.command() @click.option('--foo', help=""" hello i am multiline """) def cmd(foo): click.echo(foo) result = runner.invoke(cmd, ['--help']) > assert result.exit_code == 0 E assert -1 == 0 E + where -1 = .exit_code tests/test_options.py:275: AssertionError __________________________ test_argument_custom_class __________________________ runner = def test_argument_custom_class(runner): class CustomArgument(click.Argument): def get_default(self, ctx): '''a dumb override of a default value for testing''' return 'I am a default' @click.command() @click.argument('testarg', cls=CustomArgument, default='you wont see me') def cmd(testarg): click.echo(testarg) result = runner.invoke(cmd) > assert 'I am a default' in result.output E assert 'I am a default' in '' E + where '' = .output tests/test_options.py:294: AssertionError ___________________________ test_option_custom_class ___________________________ runner = def test_option_custom_class(runner): class CustomOption(click.Option): def get_help_record(self, ctx): '''a dumb override of a help text for testing''' return ('--help', 'I am a help text') @click.command() @click.option('--testoption', cls=CustomOption, help='you wont see me') def cmd(testoption): click.echo(testoption) result = runner.invoke(cmd, ['--help']) > assert 'I am a help text' in result.output E assert 'I am a help text' in '' E + where '' = .output tests/test_options.py:310: AssertionError ____________________________ test_aliases_for_flags ____________________________ runner = def test_aliases_for_flags(runner): @click.command() @click.option('--warnings/--no-warnings', ' /-W', default=True) def cli(warnings): click.echo(warnings) result = runner.invoke(cli, ['--warnings']) > assert result.output == 'True\n' E AssertionError: assert '' == 'True\n' E + True tests/test_options.py:321: AssertionError ______________________ test_progressbar_strip_regression _______________________ runner = monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ffff5775048> def test_progressbar_strip_regression(runner, monkeypatch): label = ' padded line' @click.command() def cli(): with click.progressbar(tuple(range(10)), label=label) as progress: for thing in progress: pass monkeypatch.setattr(click._termui_impl, 'isatty', lambda _: True) > assert label in runner.invoke(cli, []).output E assert ' padded line' in '' E + where '' = .output E + where = >(, []) E + where > = .invoke tests/test_termui.py:14: AssertionError _________________________________ test_runner __________________________________ def test_runner(): @click.command() def test(): i = click.get_binary_stream('stdin') o = click.get_binary_stream('stdout') while 1: chunk = i.read(4096) if not chunk: break o.write(chunk) o.flush() runner = CliRunner() result = runner.invoke(test, input='Hello World!\n') > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_testing.py:32: AssertionError ___________________________ test_runner_with_stream ____________________________ def test_runner_with_stream(): @click.command() def test(): i = click.get_binary_stream('stdin') o = click.get_binary_stream('stdout') while 1: chunk = i.read(4096) if not chunk: break o.write(chunk) o.flush() runner = CliRunner() result = runner.invoke(test, input=ReasonableBytesIO(b'Hello World!\n')) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_testing.py:55: AssertionError _________________________________ test_prompts _________________________________ def test_prompts(): @click.command() @click.option('--foo', prompt=True) def test(foo): click.echo('foo=%s' % foo) runner = CliRunner() result = runner.invoke(test, input='wau wau\n') > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_testing.py:72: AssertionError _________________________________ test_getchar _________________________________ def test_getchar(): @click.command() def continue_it(): click.echo(click.getchar()) runner = CliRunner() result = runner.invoke(continue_it, input='y') > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_testing.py:93: AssertionError ____________________________ test_catch_exceptions _____________________________ def test_catch_exceptions(): class CustomError(Exception): pass @click.command() def cli(): raise CustomError(1) runner = CliRunner() result = runner.invoke(cli) > assert isinstance(result.exception, CustomError) E assert False E + where False = isinstance(RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',), .CustomError'>) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_testing.py:108: AssertionError _______________________________ test_with_color ________________________________ @pytest.mark.skipif(WIN, reason='Test does not make sense on Windows.') def test_with_color(): @click.command() def cli(): click.secho('hello world', fg='blue') runner = CliRunner() result = runner.invoke(cli) > assert result.output == 'hello world\n' E AssertionError: assert '' == 'hello world\n' E + hello world tests/test_testing.py:130: AssertionError ____________________ test_with_color_but_pause_not_blocking ____________________ def test_with_color_but_pause_not_blocking(): @click.command() def cli(): click.pause() runner = CliRunner() result = runner.invoke(cli, color=True) > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_testing.py:145: AssertionError ___________________ test_exit_code_and_output_from_sys_exit ____________________ def test_exit_code_and_output_from_sys_exit(): # See issue #362 @click.command() def cli_string(): click.echo('hello world') sys.exit('error') @click.command() def cli_int(): click.echo('hello world') sys.exit(1) @click.command() def cli_float(): click.echo('hello world') sys.exit(1.0) @click.command() def cli_no_error(): click.echo('hello world') runner = CliRunner() result = runner.invoke(cli_string) > assert result.exit_code == 1 E assert -1 == 1 E + where -1 = .exit_code tests/test_testing.py:173: AssertionError ___________________________________ test_env ___________________________________ def test_env(): @click.command() def cli_env(): click.echo('ENV=%s' % os.environ['TEST_CLICK_ENV']) runner = CliRunner() env_orig = dict(os.environ) env = dict(env_orig) assert 'TEST_CLICK_ENV' not in env env['TEST_CLICK_ENV'] = 'some_value' result = runner.invoke(cli_env, env=env) > assert result.exit_code == 0 E assert -1 == 0 E + where -1 = .exit_code tests/test_testing.py:201: AssertionError __________________________________ test_echo ___________________________________ runner = def test_echo(runner): with runner.isolation() as out: click.echo(u'\N{SNOWMAN}') click.echo(b'\x44\x44') click.echo(42, nl=False) click.echo(b'a', nl=False) click.echo('\x1b[31mx\x1b[39m', nl=False) bytes = out.getvalue().replace(b'\r\n', b'\n') assert bytes == b'\xe2\x98\x83\nDD\n42ax' # If we are in Python 2, we expect that writing bytes into a string io # does not do anything crazy. In Python 3 if sys.version_info[0] == 2: import StringIO sys.stdout = x = StringIO.StringIO() try: click.echo('\xf6') finally: sys.stdout = sys.__stdout__ assert x.getvalue() == '\xf6\n' # And in any case, if wrapped, we expect bytes to survive. @click.command() def cli(): click.echo(b'\xf6') result = runner.invoke(cli, []) > assert result.output_bytes == b'\xf6\n' E AssertionError: assert b'' == b'\xf6\n' E Right contains more items, first extra item: 246 E Full diff: E - b'' E + b'\xf6\n' tests/test_utils.py:38: AssertionError _________________________________ test_prompts _________________________________ runner = def test_prompts(runner): @click.command() def test(): if click.confirm('Foo'): click.echo('yes!') else: click.echo('no :(') result = runner.invoke(test, input='y\n') > assert not result.exception E assert not RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_utils.py:102: AssertionError ________________________________ test_open_file ________________________________ runner = def test_open_file(runner): with runner.isolated_filesystem(): with open('hello.txt', 'w') as f: f.write('Cool stuff') @click.command() @click.argument('filename') def cli(filename): with click.open_file(filename) as f: click.echo(f.read()) click.echo('meep') result = runner.invoke(cli, ['hello.txt']) > assert result.exception is None E assert RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) is None E + where RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for the envi...could not pick up from it because\nit does not exist. The exported locale is "en_US.UTF-8" but it\nis not supported',) = .exception tests/test_utils.py:258: AssertionError =============== 98 failed, 21 passed, 1 xfailed in 1.26 seconds ================ error: Bad exit status from /var/tmp/rpm-tmp.aMfE0v (%check) RPM build errors: Bad exit status from /var/tmp/rpm-tmp.aMfE0v (%check) Child return code was: 1 EXCEPTION: [Error('Command failed: \n # /usr/bin/systemd-nspawn -q -M 7051221fd703443c80ab3640dcb0e534 -D /var/lib/mock/inferit-8_8-build-19266-28569/root -a -u mockbuild --capability=cap_ipc_lock --bind=/tmp/mock-resolv.nl85iffc:/etc/resolv.conf --bind=/dev/mapper/control --bind=/dev/loop-control --bind=/dev/loop0 --bind=/dev/loop1 --bind=/dev/loop2 --bind=/dev/loop3 --bind=/dev/loop4 --bind=/dev/loop5 --bind=/dev/loop6 --bind=/dev/loop7 --bind=/dev/loop8 --bind=/dev/loop9 --bind=/dev/loop10 --bind=/dev/loop11 --console=pipe --setenv=TERM=vt100 --setenv=SHELL=/bin/bash --setenv=HOME=/builddir --setenv=HOSTNAME=mock --setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin --setenv=PROMPT_COMMAND=printf "\\033]0;\\007" --setenv=PS1= \\s-\\v\\$ --setenv=LANG=C.UTF-8 --resolv-conf=off bash --login -c /usr/bin/rpmbuild -bb --noclean --target noarch --nodeps /builddir/build/SPECS/python-click.spec\n', 1)] Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/mockbuild/trace_decorator.py", line 93, in trace result = func(*args, **kw) File "/usr/lib/python3.9/site-packages/mockbuild/util.py", line 597, in do_with_status raise exception.Error("Command failed: \n # %s\n%s" % (command, output), child.returncode) mockbuild.exception.Error: Command failed: # /usr/bin/systemd-nspawn -q -M 7051221fd703443c80ab3640dcb0e534 -D /var/lib/mock/inferit-8_8-build-19266-28569/root -a -u mockbuild --capability=cap_ipc_lock --bind=/tmp/mock-resolv.nl85iffc:/etc/resolv.conf --bind=/dev/mapper/control --bind=/dev/loop-control --bind=/dev/loop0 --bind=/dev/loop1 --bind=/dev/loop2 --bind=/dev/loop3 --bind=/dev/loop4 --bind=/dev/loop5 --bind=/dev/loop6 --bind=/dev/loop7 --bind=/dev/loop8 --bind=/dev/loop9 --bind=/dev/loop10 --bind=/dev/loop11 --console=pipe --setenv=TERM=vt100 --setenv=SHELL=/bin/bash --setenv=HOME=/builddir --setenv=HOSTNAME=mock --setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin --setenv=PROMPT_COMMAND=printf "\033]0;\007" --setenv=PS1= \s-\v\$ --setenv=LANG=C.UTF-8 --resolv-conf=off bash --login -c /usr/bin/rpmbuild -bb --noclean --target noarch --nodeps /builddir/build/SPECS/python-click.spec