-
-
Notifications
You must be signed in to change notification settings - Fork 671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Ensure rich_markup_mode=None
disables Rich formatting
#859
Changes from all commits
2cfd641
fef4a8a
74e69af
01fef55
16ce4e5
98a8ec0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import typer | ||
import typer.completion | ||
from typer.testing import CliRunner | ||
|
||
runner = CliRunner() | ||
rounded = ["╭", "─", "┬", "╮", "│", "├", "┼", "┤", "╰", "┴", "╯"] | ||
|
||
|
||
def test_rich_markup_mode_none(): | ||
app = typer.Typer(rich_markup_mode=None) | ||
|
||
@app.command() | ||
def main(arg: str): | ||
"""Main function""" | ||
print(f"Hello {arg}") | ||
|
||
assert app.rich_markup_mode is None | ||
|
||
result = runner.invoke(app, ["World"]) | ||
assert "Hello World" in result.stdout | ||
|
||
result = runner.invoke(app, ["--help"]) | ||
assert all(c not in result.stdout for c in rounded) | ||
|
||
|
||
def test_rich_markup_mode_rich(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test fails with 0.12.5 release
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @kraj, thanks for the comment. That's odd - I can't reproduce the test failure locally and the CI goes green with this change as well. Could you please open a new discussion thread to look into this more, and provide us there with more information about your system setup and the failure you're seeing? 🙏 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I build a minimal image which just have a kernel+busybox+typer and its dependencies. So perhaps thats the difference, some implicit dependency coming in indirectly on full distributions like ubuntu, fedora etc in CI |
||
app = typer.Typer(rich_markup_mode="rich") | ||
|
||
@app.command() | ||
def main(arg: str): | ||
"""Main function""" | ||
print(f"Hello {arg}") | ||
|
||
assert app.rich_markup_mode == "rich" | ||
|
||
result = runner.invoke(app, ["World"]) | ||
assert "Hello World" in result.stdout | ||
|
||
result = runner.invoke(app, ["--help"]) | ||
assert any(c in result.stdout for c in rounded) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test currently fails on
master
, which is clearly a bug IMO.