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

Doctests #274

Merged
merged 7 commits into from
Oct 18, 2023
Merged

Doctests #274

merged 7 commits into from
Oct 18, 2023

Conversation

znicholls
Copy link
Collaborator

@znicholls znicholls commented Oct 18, 2023

Pull request

Please confirm that this pull request has done the following:

  • Tests added
  • Documentation added (where applicable)
  • Example added (either to an existing notebook or as a new notebook, where applicable)
  • Changelog in '/changelog' added

@znicholls znicholls marked this pull request as ready for review October 18, 2023 09:40
Copy link
Member

@mikapfl mikapfl left a comment

Choose a reason for hiding this comment

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

Looks good, better to run doctests whenever other tests are run.

Copy link
Collaborator

@lewisjared lewisjared left a comment

Choose a reason for hiding this comment

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

Nice. We were a bit lazy writing the initial tests using non-existant variables :D

@znicholls
Copy link
Collaborator Author

I'm going to use this fix to avoid the terminal width issue pytest-dev/pytest#4030 (comment)

@znicholls
Copy link
Collaborator Author

Adding the doctests breaks the code coverage. I think there is a fix for this, but I don't know what it is (maybe a non-editable install) and I'm giving up for the day.

@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (bf80b14) 95.15% compared to head (657eab8) 95.15%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #274   +/-   ##
=======================================
  Coverage   95.15%   95.15%           
=======================================
  Files          24       24           
  Lines        2190     2190           
  Branches      404      404           
=======================================
  Hits         2084     2084           
  Misses         86       86           
  Partials       20       20           
Files Coverage Δ
src/scmdata/groupby.py 78.40% <ø> (ø)
src/scmdata/ops.py 99.50% <ø> (ø)
src/scmdata/run.py 95.00% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@znicholls
Copy link
Collaborator Author

Adding the doctests breaks the code coverage. I think there is a fix for this, but I don't know what it is (maybe a non-editable install) and I'm giving up for the day.

This discussion is incredibly helpful for debugging these kind of issues.

tl-dr; something like COVERAGE_DEBUG=trace poetry run pytest src --doctest-modules --cov=scmdata -s or COVERAGE_DEBUG=trace COVERAGE_DEBUG_FILE=/Users/znicholls/Desktop/dbg.out poetry run pytest src --doctest-modules --cov=scmdata is super helpful because you can see what isn't being traced.

For whatever reason, coverage thinks that the modules that have the doctests in them aren't in the source scope for some reason unless we specify --cov=src. I was getting output like the below

Not tracing '/Users/znicholls/Documents/repos-agcec/scmdata/src/scmdata/groupby.py': module 'src.scmdata.groupby' falls outside the --source spec

I have no idea why this happens, something to do with these lines

@znicholls znicholls merged commit 417aa05 into master Oct 18, 2023
16 checks passed
@znicholls znicholls deleted the doctests branch October 18, 2023 15:05
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.

3 participants