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

Measure actual coverage, not "cell coverage" #156

Open
ceball opened this issue May 28, 2020 · 2 comments
Open

Measure actual coverage, not "cell coverage" #156

ceball opened this issue May 28, 2020 · 2 comments
Labels
part: cell tests Relating to cell testing component type: enhancement Minor improvements

Comments

@ceball
Copy link
Collaborator

ceball commented May 28, 2020

Current cell coverage (num cells tested)/(num cells) is a proxy for actual coverage.

nbval includes a coverage measure - should investigate that.

Current coverage is relatively easy to fake, e.g.

if False:
    %cell

Something related to "what actually ran?" (e.g. detection that cell source was submitted to kernel) might be better than a static check.

@ceball ceball added part: cell tests Relating to cell testing component feature labels May 28, 2020
@timkpaine
Copy link
Collaborator

@vidartf is this something you can help with? I see you've done it for nbval computationalmodelling/nbval#134

since we have the %cell injection, I would think all we need to do is maintain a map of nb line # to test line #, inject coverage.py into the test itself, then match back the covered line using the mapping.

@vidartf
Copy link
Collaborator

vidartf commented Aug 20, 2020

@timkpaine The nbval coverage is all about getting coverage data in python modules, from the execution of the notebook. It doesn't currently attempt to measure coverage in the notebook. The problem is that coverage will not be available in the same scope as the coverage gathering was started, i.e. the notebook global scope. There might be a clever work-around somehow, but I haven't dived deep enough into it to find anything.

@timkpaine timkpaine added type: enhancement Minor improvements and removed feature labels Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part: cell tests Relating to cell testing component type: enhancement Minor improvements
Projects
None yet
Development

No branches or pull requests

3 participants