-
-
Notifications
You must be signed in to change notification settings - Fork 776
🐛 Ensure that the default rich_markup_mode
is interpreted correctly
#1304
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
base: master
Are you sure you want to change the base?
Conversation
The failing coverage test reveals that there are code paths in In fact, the formatting methods in |
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.
LGTM!
Feels to me like the CI is failing due to an unrelated issue - I'll investigate. [UPDATE]: fixed with #1333 |
def test_markup_mode_default(): | ||
# We're assuming the test suite is run with rich installed | ||
app = typer.Typer() | ||
assert app.rich_markup_mode == "rich" |
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.
on master
, this fails with
<typer.models.DefaultPlaceholder object at 0x00000227BB50B130> != rich
By using
Default(DEFAULT_MARKUP_MODE)
,rich_markup_mode
would be atyper.models.DefaultPlaceholder
object and comparing it to other literal strings likeMARKUP_MODE_RICH
would fail. This resulted in flaky behaviour such as reported in #976, where Rich formatting worked fine when specifying it correctly, but the default value (with Rich installed) didn't result in the same behaviour.This PR fixes that by simply not using
Default
for this value - there's no real reason to use it anyway, as it's unimportant to the application whether it's a default or a user-set value.