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

test: make doctests work #240

Merged
merged 5 commits into from
Dec 27, 2023
Merged

test: make doctests work #240

merged 5 commits into from
Dec 27, 2023

Conversation

jsstevenson
Copy link
Member

https://docs.python.org/3/library/doctest.html

Kind of useful to ensure that our examples stay up to date as code changes. But also, very slow to run, since our examples re-initialize resources ever time (which I'd prefer to keep, it makes examples self-sufficient, w/o having to scroll up to see how objects were created). The old default setup.cfg file that we inherited from Alex included running module doctests as part of the default pytest args but I think that's an unnecessary practice given this -- main tests are for checking for regressions and ensuring functions, and you should only run doctests once an issue is ~complete to ensure that examples stay current.

  • Note that doctests perform basic string-to-string comparisons of REPL output. It's a little inelegant.
  • async support kinda sucks. It presumes a basic Python REPL context, which means you can't await anything outside of a function. Worse, using multiple async.run calls in a single docstring causes some sort of problem (either unfixable w/r/t doctests themselves, or something about how we're using asyncpg), so I'm currently not sure how to show multiple discrete examples for async functions.

@jsstevenson jsstevenson added the priority:low Low priority label Dec 27, 2023
@@ -100,12 +100,15 @@ def __init__(
>>> from cool_seq_tool.app import CoolSeqTool
>>> mane_mapper = CoolSeqTool().mane_transcript

Note that most methods are defined as Python coroutines, so they must be called
with ``await``:
Note that most methods are defined as Python coroutines, so the must be called
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Note that most methods are defined as Python coroutines, so the must be called
Note that most methods are defined as Python coroutines, so they must be called

@jsstevenson jsstevenson merged commit a957544 into staging Dec 27, 2023
12 checks passed
@jsstevenson jsstevenson deleted the doctest branch December 27, 2023 17:50
korikuzma pushed a commit that referenced this pull request Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:low Low priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants