+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-typer-0.5.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-typer-0.5.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/typer-0.5.0
plugins: cov-3.0.0
collected 507 items
docs_src/testing/app01/test_main.py . [ 0%]
docs_src/testing/app02/test_main.py . [ 0%]
docs_src/testing/app03/test_main.py . [ 0%]
tests/test_others.py ........... [ 2%]
tests/test_prog_name.py . [ 2%]
tests/test_tracebacks.py F.. [ 3%]
tests/test_type_conversion.py .......... [ 5%]
tests/test_compat/test_option_get_help.py ... [ 6%]
tests/test_completion/test_completion.py FF........ [ 8%]
tests/test_completion/test_completion_complete.py .......... [ 10%]
tests/test_completion/test_completion_complete_no_help.py .... [ 10%]
tests/test_completion/test_completion_install.py .F... [ 11%]
tests/test_completion/test_completion_show.py ...... [ 13%]
tests/test_tutorial/test_arguments/test_default/test_tutorial001.py .... [ 13%]
tests/test_tutorial/test_arguments/test_default/test_tutorial002.py .... [ 14%]
tests/test_tutorial/test_arguments/test_envvar/test_tutorial001.py ..... [ 15%]
tests/test_tutorial/test_arguments/test_envvar/test_tutorial002.py ..... [ 16%]
tests/test_tutorial/test_arguments/test_envvar/test_tutorial003.py ..... [ 17%]
tests/test_tutorial/test_arguments/test_help/test_tutorial001.py ... [ 18%]
tests/test_tutorial/test_arguments/test_help/test_tutorial002.py ... [ 18%]
tests/test_tutorial/test_arguments/test_help/test_tutorial003.py ... [ 19%]
tests/test_tutorial/test_arguments/test_help/test_tutorial004.py ... [ 19%]
tests/test_tutorial/test_arguments/test_help/test_tutorial005.py ... [ 20%]
tests/test_tutorial/test_arguments/test_help/test_tutorial006.py ... [ 21%]
tests/test_tutorial/test_arguments/test_help/test_tutorial007.py ... [ 21%]
tests/test_tutorial/test_arguments/test_optional/test_tutorial001.py ... [ 22%]
tests/test_tutorial/test_arguments/test_optional/test_tutorial002.py .... [ 23%]
tests/test_tutorial/test_commands/test_arguments/test_tutorial001.py ..... [ 24%]
tests/test_tutorial/test_commands/test_callback/test_tutorial001.py ....... [ 25%]
tests/test_tutorial/test_commands/test_callback/test_tutorial002.py .. [ 25%]
tests/test_tutorial/test_commands/test_callback/test_tutorial003.py ... [ 26%]
tests/test_tutorial/test_commands/test_callback/test_tutorial004.py ... [ 27%]
tests/test_tutorial/test_commands/test_context/test_tutorial001.py ... [ 27%]
tests/test_tutorial/test_commands/test_context/test_tutorial002.py .... [ 28%]
tests/test_tutorial/test_commands/test_context/test_tutorial003.py .... [ 29%]
tests/test_tutorial/test_commands/test_context/test_tutorial004.py .. [ 29%]
tests/test_tutorial/test_commands/test_help/test_tutorial001.py ............ [ 31%]
tests/test_tutorial/test_commands/test_help/test_tutorial002.py ...... [ 33%]
tests/test_tutorial/test_commands/test_index/test_tutorial001.py ... [ 33%]
tests/test_tutorial/test_commands/test_index/test_tutorial002.py .... [ 34%]
tests/test_tutorial/test_commands/test_name/test_tutorial001.py .... [ 35%]
tests/test_tutorial/test_commands/test_one_or_multiple/test_tutorial001.py ... [ 35%]
tests/test_tutorial/test_commands/test_one_or_multiple/test_tutorial002.py ... [ 36%]
tests/test_tutorial/test_commands/test_options/test_tutorial001.py ......... [ 38%]
tests/test_tutorial/test_first_steps/test_tutorial001.py .. [ 38%]
tests/test_tutorial/test_first_steps/test_tutorial002.py ... [ 39%]
tests/test_tutorial/test_first_steps/test_tutorial003.py ... [ 39%]
tests/test_tutorial/test_first_steps/test_tutorial004.py ...... [ 41%]
tests/test_tutorial/test_first_steps/test_tutorial005.py ...... [ 42%]
tests/test_tutorial/test_first_steps/test_tutorial006.py ...... [ 43%]
tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial001.py .. [ 43%]
tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial002.py ..... [ 44%]
tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial001.py .... [ 45%]
tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial002.py .... [ 46%]
tests/test_tutorial/test_multiple_values/test_options_with_multiple_values/test_tutorial001.py ..... [ 47%]
tests/test_tutorial/test_options/test_callback/test_tutorial001.py ... [ 47%]
tests/test_tutorial/test_options/test_callback/test_tutorial003.py .... [ 48%]
tests/test_tutorial/test_options/test_callback/test_tutorial004.py .... [ 49%]
tests/test_tutorial/test_options/test_completion/test_tutorial002.py ... [ 50%]
tests/test_tutorial/test_options/test_completion/test_tutorial003.py ... [ 50%]
tests/test_tutorial/test_options/test_completion/test_tutorial004.py ... [ 51%]
tests/test_tutorial/test_options/test_completion/test_tutorial007.py ... [ 51%]
tests/test_tutorial/test_options/test_completion/test_tutorial008.py ... [ 52%]
tests/test_tutorial/test_options/test_completion/test_tutorial009.py ... [ 53%]
tests/test_tutorial/test_options/test_help/test_tutorial001.py ..... [ 54%]
tests/test_tutorial/test_options/test_help/test_tutorial002.py ... [ 54%]
tests/test_tutorial/test_options/test_name/test_tutorial001.py ... [ 55%]
tests/test_tutorial/test_options/test_name/test_tutorial002.py .... [ 56%]
tests/test_tutorial/test_options/test_name/test_tutorial003.py ... [ 56%]
tests/test_tutorial/test_options/test_name/test_tutorial004.py .... [ 57%]
tests/test_tutorial/test_options/test_name/test_tutorial005.py ...... [ 58%]
tests/test_tutorial/test_options/test_prompt/test_tutorial001.py .... [ 59%]
tests/test_tutorial/test_options/test_prompt/test_tutorial002.py .... [ 60%]
tests/test_tutorial/test_options/test_prompt/test_tutorial003.py ..... [ 61%]
tests/test_tutorial/test_options/test_required/test_tutorial002.py .... [ 61%]
tests/test_tutorial/test_options/test_version/test_tutorial003.py ..... [ 62%]
tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001.py ..... [ 63%]
tests/test_tutorial/test_parameter_types/test_bool/test_tutorial002.py ...... [ 65%]
tests/test_tutorial/test_parameter_types/test_bool/test_tutorial003.py .... [ 65%]
tests/test_tutorial/test_parameter_types/test_bool/test_tutorial004.py ..... [ 66%]
tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial001.py .... [ 67%]
tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial002.py ... [ 68%]
tests/test_tutorial/test_parameter_types/test_enum/test_tutorial001.py .... [ 69%]
tests/test_tutorial/test_parameter_types/test_enum/test_tutorial002.py ... [ 69%]
tests/test_tutorial/test_parameter_types/test_file/test_tutorial001.py .. [ 70%]
tests/test_tutorial/test_parameter_types/test_file/test_tutorial002.py .. [ 70%]
tests/test_tutorial/test_parameter_types/test_file/test_tutorial003.py .. [ 70%]
tests/test_tutorial/test_parameter_types/test_file/test_tutorial004.py .. [ 71%]
tests/test_tutorial/test_parameter_types/test_file/test_tutorial005.py .. [ 71%]
tests/test_tutorial/test_parameter_types/test_index/test_tutorial001.py .... [ 72%]
tests/test_tutorial/test_parameter_types/test_number/test_tutorial001.py ....... [ 73%]
tests/test_tutorial/test_parameter_types/test_number/test_tutorial002.py ... [ 74%]
tests/test_tutorial/test_parameter_types/test_number/test_tutorial003.py ....... [ 75%]
tests/test_tutorial/test_parameter_types/test_path/test_tutorial001.py ..... [ 76%]
tests/test_tutorial/test_parameter_types/test_path/test_tutorial002.py .... [ 77%]
tests/test_tutorial/test_parameter_types/test_uuid/test_tutorial001.py ... [ 78%]
tests/test_tutorial/test_prompt/test_tutorial001.py .. [ 78%]
tests/test_tutorial/test_prompt/test_tutorial002.py ... [ 79%]
tests/test_tutorial/test_prompt/test_tutorial003.py ... [ 79%]
tests/test_tutorial/test_subcommands/test_tutorial001.py ......... [ 81%]
tests/test_tutorial/test_subcommands/test_tutorial002.py ......... [ 83%]
tests/test_tutorial/test_subcommands/test_tutorial003.py ................ [ 86%]
tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial001.py .. [ 86%]
tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial002.py .. [ 87%]
tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial003.py ... [ 87%]
tests/test_tutorial/test_subcommands/test_callback_override/test_tutorial004.py ... [ 88%]
tests/test_tutorial/test_subcommands/test_name_help/test_tutorial001.py .... [ 89%]
tests/test_tutorial/test_subcommands/test_name_help/test_tutorial002.py .... [ 89%]
tests/test_tutorial/test_subcommands/test_name_help/test_tutorial003.py .... [ 90%]
tests/test_tutorial/test_subcommands/test_name_help/test_tutorial004.py .... [ 91%]
tests/test_tutorial/test_subcommands/test_name_help/test_tutorial005.py .... [ 92%]
tests/test_tutorial/test_subcommands/test_name_help/test_tutorial006.py .... [ 93%]
tests/test_tutorial/test_subcommands/test_name_help/test_tutorial007.py .... [ 93%]
tests/test_tutorial/test_subcommands/test_name_help/test_tutorial008.py .... [ 94%]
tests/test_tutorial/test_terminating/test_tutorial001.py ... [ 95%]
tests/test_tutorial/test_terminating/test_tutorial002.py ... [ 95%]
tests/test_tutorial/test_terminating/test_tutorial003.py ... [ 96%]
tests/test_tutorial/test_testing/test_app01.py ... [ 97%]
tests/test_tutorial/test_testing/test_app02.py ... [ 97%]
tests/test_tutorial/test_testing/test_app03.py ... [ 98%]
tests/test_tutorial/test_using_click/test_tutorial003.py .... [ 99%]
tests/test_tutorial/test_using_click/test_tutorial004.py ..... [100%]
================================================================================= FAILURES =================================================================================
___________________________________________________________________________ test_traceback_rich ____________________________________________________________________________
def test_traceback_rich():
file_path = Path(__file__).parent / "assets/type_error_rich.py"
result = subprocess.run(
["coverage", "run", str(file_path)],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
)
assert "return get_command(self)(*args, **kwargs)" not in result.stderr
assert "typer.run(main)" in result.stderr
assert "print(name + 3)" in result.stderr
# TODO: when deprecating Python 3.6, remove second option
assert (
'TypeError: can only concatenate str (not "int") to str' in result.stderr
or "TypeError: must be str, not int" in result.stderr
)
> assert "name = 'morty'" in result.stderr
E assert "name = 'morty'" in 'Traceback (most recent call last):\n\n File "/home/tkloczko/rpmbuild/BUILD/typer-0.5.0/tests/assets/type_error_rich....ype_error_rich.py", line 5, in main\n print(name + 3)\n\nTypeError: can only concatenate str (not "int") to str\n\n'
E + where 'Traceback (most recent call last):\n\n File "/home/tkloczko/rpmbuild/BUILD/typer-0.5.0/tests/assets/type_error_rich....ype_error_rich.py", line 5, in main\n print(name + 3)\n\nTypeError: can only concatenate str (not "int") to str\n\n' = CompletedProcess(args=['coverage', 'run', '/home/tkloczko/rpmbuild/BUILD/typer-0.5.0/tests/assets/type_error_rich.py']...pe_error_rich.py", line 5, in main\n print(name + 3)\n\nTypeError: can only concatenate str (not "int") to str\n\n').stderr
tests/test_tracebacks.py:23: AssertionError
___________________________________________________________________________ test_show_completion ___________________________________________________________________________
def test_show_completion():
result = subprocess.run(
[
"bash",
"-c",
f"{sys.executable} -m coverage run {mod.__file__} --show-completion",
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
env={**os.environ, "SHELL": "/bin/bash", "_TYPER_COMPLETE_TESTING": "True"},
)
> assert "_TUTORIAL001.PY_COMPLETE=complete_bash" in result.stdout
E AssertionError: assert '_TUTORIAL001.PY_COMPLETE=complete_bash' in ''
E + where '' = CompletedProcess(args=['bash', '-c', '/usr/bin/python3 -m coverage run /home/tkloczko/rpmbuild/BUILD/typer-0.5.0/docs_src/first_steps/tutorial001.py --show-completion'], returncode=1, stdout='', stderr='Shell sh not supported.\n').stdout
tests/test_completion/test_completion.py:21: AssertionError
_________________________________________________________________________ test_install_completion __________________________________________________________________________
def test_install_completion():
bash_completion_path: Path = Path.home() / ".bashrc"
text = ""
if bash_completion_path.is_file(): # pragma: nocover
text = bash_completion_path.read_text()
result = subprocess.run(
[
"bash",
"-c",
f"{sys.executable} -m coverage run {mod.__file__} --install-completion",
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
env={**os.environ, "SHELL": "/bin/bash", "_TYPER_COMPLETE_TESTING": "True"},
)
new_text = bash_completion_path.read_text()
> bash_completion_path.write_text(text)
tests/test_completion/test_completion.py:41:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.8/pathlib.py:1255: in write_text
with self.open(mode='w', encoding=encoding, errors=errors) as f:
/usr/lib64/python3.8/pathlib.py:1222: in open
return io.open(self, mode, buffering, encoding, errors, newline,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = PosixPath('/home/tkloczko/.bashrc'), name = '/home/tkloczko/.bashrc', flags = 524865, mode = 438
def _opener(self, name, flags, mode=0o666):
# A stub for the opener argument to built-in open()
> return self._accessor.open(self, flags, mode)
E PermissionError: [Errno 13] Permission denied: '/home/tkloczko/.bashrc'
/usr/lib64/python3.8/pathlib.py:1078: PermissionError
_______________________________________________________________________ test_completion_install_bash _______________________________________________________________________
def test_completion_install_bash():
bash_completion_path: Path = Path.home() / ".bashrc"
text = ""
if bash_completion_path.is_file():
text = bash_completion_path.read_text()
result = subprocess.run(
["coverage", "run", mod.__file__, "--install-completion", "bash"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
env={
**os.environ,
"_TYPER_COMPLETE_TESTING": "True",
"_TYPER_COMPLETE_TEST_DISABLE_SHELL_DETECTION": "True",
},
)
new_text = bash_completion_path.read_text()
> bash_completion_path.write_text(text)
tests/test_completion/test_completion_install.py:53:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.8/pathlib.py:1255: in write_text
with self.open(mode='w', encoding=encoding, errors=errors) as f:
/usr/lib64/python3.8/pathlib.py:1222: in open
return io.open(self, mode, buffering, encoding, errors, newline,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = PosixPath('/home/tkloczko/.bashrc'), name = '/home/tkloczko/.bashrc', flags = 524865, mode = 438
def _opener(self, name, flags, mode=0o666):
# A stub for the opener argument to built-in open()
> return self._accessor.open(self, flags, mode)
E PermissionError: [Errno 13] Permission denied: '/home/tkloczko/.bashrc'
/usr/lib64/python3.8/pathlib.py:1078: PermissionError
============================================================================= warnings summary =============================================================================
tests/test_tutorial/test_options/test_completion/test_tutorial002.py::test_1
tests/test_tutorial/test_options/test_completion/test_tutorial003.py::test_1
tests/test_tutorial/test_options/test_completion/test_tutorial004.py::test_1
tests/test_tutorial/test_options/test_completion/test_tutorial007.py::test_1
tests/test_tutorial/test_options/test_completion/test_tutorial008.py::test_1
tests/test_tutorial/test_options/test_completion/test_tutorial009.py::test_1
/home/tkloczko/rpmbuild/BUILDROOT/python-typer-0.5.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/typer/core.py:270: DeprecationWarning: 'autocompletion' is renamed to 'shell_complete'. The old name is deprecated and will be removed in Click 8.1. See the docs about 'Parameter' for information about new behavior.
_typer_param_setup_autocompletion_compat(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
FAILED tests/test_tracebacks.py::test_traceback_rich - assert "name = 'morty'" in 'Traceback (most recent call last):\n\n File "/home/tkloczko/rpmbuild/BUILD/typer-0.5....
FAILED tests/test_completion/test_completion.py::test_show_completion - AssertionError: assert '_TUTORIAL001.PY_COMPLETE=complete_bash' in ''
FAILED tests/test_completion/test_completion.py::test_install_completion - PermissionError: [Errno 13] Permission denied: '/home/tkloczko/.bashrc'
FAILED tests/test_completion/test_completion_install.py::test_completion_install_bash - PermissionError: [Errno 13] Permission denied: '/home/tkloczko/.bashrc'
================================================================ 4 failed, 503 passed, 6 warnings in 35.40s ================================================================
First Check
Commit to Help
Example Code
Description
I'm packaging your module as the rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolationbuildwith--no-isolationI'm using during all processes only locally installed modulesLooks like ltwo unist are tring to modify my ~/.bashrc
Here is pytest output:
Details
Wanted Solution
pytest shopuld be working and test suite should not be fidling in user ~/,bashrc
Wanted Code
Alternatives
No response
Operating System
Linux
Operating System Details
No response
Typer Version
0.5.0
Python Version
3.8.13
Additional Context
Not applicable