Skip to content

Conversation

@jwodder
Copy link
Contributor

@jwodder jwodder commented Jun 14, 2018

This fixes #3583. This fix was suggested by Stack Overflow user phd in
https://stackoverflow.com/a/50863820/744178.

@jwodder
Copy link
Contributor Author

jwodder commented Jun 14, 2018

I would have added the minimal example from #3583 as a test case, but I wasn't sure how exactly to do that. Someone who knows what they're doing should probably do that.

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jwodder,

Thanks a lot for the PR, we appreciate it.

Could you please include a test which reproduces the problem you describe in #3583?

I suggest to take a look at the other tests in test_doctest.py for inspiration.

@@ -0,0 +1 @@
Fix encoding error with `print` statements in doctests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be rst:

Fix encoding error with ``print`` statements in doctests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is RST; reStructuredText uses single backticks for individual identifiers, while double backticks are for arbitrary inline code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you are right, sorry;

We use inline code in the changelog though because there won't be any references to it in the final document (but TBH I don't remember if they render differently).

@coveralls
Copy link

coveralls commented Jun 14, 2018

Coverage Status

Coverage increased (+0.05%) to 92.708% when pulling d382f3e on jwodder:fix-3583 into 4d0297b on pytest-dev:master.

@jwodder
Copy link
Contributor Author

jwodder commented Jun 14, 2018

@nicoddemus I added a failing test case, but now the fix doesn't fix it; it was working when I tried modifying a copy of pytest in a virtualenv a few hours ago....

@jwodder
Copy link
Contributor Author

jwodder commented Jun 15, 2018

I figured out what was wrong with the test case I added (the string should have been raw); it now correctly fails before applying the fix and succeeds after.

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks again @jwodder!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Printing Unicode in doctest under Python 2.7 doesn't work

3 participants