Cannot test stdin with CliRunner, input does not seem to be propagated to the app correctly #560
Unanswered
InCogNiTo124
asked this question in
Questions
Replies: 1 comment
-
It's still unresolved with 0.9.0 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
The issue seems to be inability to test stdin with CliRunner.
To reproduce:
main.py
with the contents as above.python3 main.py
.1
and press return.2
and press return.3
and press return.5
and press return.Ctrl+D
.Output: script outputs the numbers in the reverse order. this is a wanted behavior.
However I can't test this behaviour with
CliRunner
. To reproduce:test_main.py
with the contents as abovepytest test_main.py
this is not a wanted behaviour
I tried looking into source code and on the github issues for the solutions or workarounds but I couldn't find anything connected to this.
Operating System
Linux
Operating System Details
Operating System: Manjaro Linux
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.12-1-MANJARO (64-bit)
Graphics Platform: X11
Processors: 20 × 13th Gen Intel® Core™ i5-13600K
Memory: 62.6 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3090 Ti/PCIe/SSE2
Product Name: Z790 Pro RS
Typer Version
0.7.0
Python Version
Python 3.10.9
Additional Context
The main context is that I wish to make a CLI that does both of the following:
cat /dev/urandom | CLI
this is a standard behaviour of some unix tools, e.g.
cat
.I tried to make a minimal Click reproducible example to verify this is indeed due to Typer but I have failed to do so; if someone else has enough knowledge I would appreciate it :))
Beta Was this translation helpful? Give feedback.
All reactions