Skip to content

Change doctest runner's flags #344

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

Closed
pytestbot opened this issue Aug 16, 2013 · 1 comment
Closed

Change doctest runner's flags #344

pytestbot opened this issue Aug 16, 2013 · 1 comment
Labels
type: enhancement new feature or API change, should be merged into features branch

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Aleks Bunin (BitBucket: b-enlnt, GitHub: b-enlnt)


py.test does not provide hooks to change doctest runner's option flags. We worked around this problem by patching the runner as shown below.

#!diff

--- a/_pytest/doctest.py 2013-06-24 19:07:08.000000000 -0400
+++ b/_pytest/doctest.py 2013-07-08 15:44:49.445935070 -0400
@@ -87,7 +87,7 @@
         fixture_request = FixtureRequest(self)
         failed, tot = doctest.testfile(
             str(self.fspath), module_relative=False,
-            optionflags=doctest.ELLIPSIS,
+            optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE,
             extraglobs=dict(getfixture=fixture_request.getfuncargvalue),
             raise_on_error=True, verbose=0)

@@ -105,4 +105,4 @@
         failed, tot = doctest.testmod(
             module, raise_on_error=True, verbose=0,
             extraglobs=dict(getfixture=fixture_request.getfuncargvalue),
-            optionflags=doctest.ELLIPSIS)
+            optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE)


@pytestbot pytestbot added the type: enhancement new feature or API change, should be merged into features branch label Jun 15, 2015
@RonnyPfannschmidt
Copy link
Member

Closing as stalled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

2 participants