Skip to content
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

Use manuel to run doctest files. #27

Merged
merged 1 commit into from
Mar 16, 2017
Merged

Use manuel to run doctest files. #27

merged 1 commit into from
Mar 16, 2017

Conversation

jamadden
Copy link
Member

We can't use the codeblock plugin for the using-logging test, instead
resorting to manually execing the captured source. This is because
stdout is not captured by a codeblock, so logging would be configured
to go to the real stdout, not one captured by the next doctest we
do (where we do want to use the doctest syntax) and our output
wouldn't get seen. This was maddening to figure out.

You can't use the capture plugin to capture literal includes, so we
still have the chdir hacks.

Overall it's not a whole lot of a win, at least right now.

I changed some of the text strings that we log to make them a bit more
descriptive. This was part of debuging too, but I think they're
better.

I ran into a problem doing 'python -m ZConfig.tests.test_readme' that
I added a workaround for.

We can't use the codeblock plugin for the using-logging test, instead
resorting to manually execing the captured source. This is because
stdout is not captured by a codeblock, so logging would be configured
to go to the *real* stdout, not one captured by the next doctest we
do (where we do want to use the doctest syntax) and our output
wouldn't get seen. This was maddening to figure out.

You can't use the capture plugin to capture literal includes, so we
still have the chdir hacks.

Overall it's not a whole lot of a win, at least right now.

I changed some of the text strings that we log to make them a bit more
descriptive. This was part of debuging too, but I think they're
better.

I ran into a problem doing 'python -m ZConfig.tests.test_readme' that
I added a workaround for.
@jimfulton
Copy link
Member

jimfulton commented Mar 16, 2017 via email

@@ -7,26 +7,33 @@ framework. ZConfig provides one simple convenience function to do this:

.. autofunction:: ZConfig.configureLoggers


Suppose we have the following logging configuration in a file called ``simple-root-config.conf``:

.. literalinclude:: simple-root-config.conf
Copy link
Member

Choose a reason for hiding this comment

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

That seems like a reasonable approach too.

I wasn't aware of this. I assume this shows up on RTD.

Cool.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, things look good on RTD, even before this: http://zconfig.readthedocs.io/en/latest/using-logging.html

The doctest examples were small enough that the prompts weren't much of an eyesore, at least not to me.

@jimfulton
Copy link
Member

I agree that after using literalinclude the incremental benefit of manuel was small.

@jamadden
Copy link
Member Author

All that manual.capture gives you is access to example text. It doesn't run
anything. You then need to test that executing the text or comparing it to
output is as expected.

I was expecting that from previous examples. It's not ideal---being able to use the codeblock plugin would be ideal---but it works and it's slightly cleaner to read, and really, just slightly cleaner to write, too because the execution is explicit instead of implicit.

I agree that after using literalinclude the incremental benefit of manuel was small.

Small but non-zero. It was nice to be able to use the same doctest.Manuel instance, for example, to get to only have to specify the option flags once.

There are some other cleanups in here too, but I admit they're pretty unrelated to manuel proper.

@jimfulton
Copy link
Member

LGTM

@jamadden jamadden merged commit d8cdd28 into master Mar 16, 2017
@jamadden
Copy link
Member Author

Thanks for the review!

@jamadden jamadden deleted the jam-use-manuel branch March 16, 2017 20:16
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.

2 participants