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

What is the right way to use coverage.py with Tensorflow? #33759

Open
nedbat opened this issue Oct 27, 2019 · 0 comments
Assignees
Labels

Comments

@nedbat
Copy link

@nedbat nedbat commented Oct 27, 2019

I apologize if this is the wrong way to ask this question. I'm the maintainer of coverage.py, for measuring code coverage in Python projects. A user wrote an issue for me: nedbat/coveragepy#856

After digging into it, I see that his tf.keras.Model.call() function is not executed directly, but is transformed into a temporary file, and executed there. So coverage.py reports that his code is unexecuted, even though he can see the effects of its execution.

I also see that the transformed code has an ag_source_map__ parameter which can be used to map back from the transformed code to the original code. A coverage.py plugin could use that information to report coverage usefully.

My questions are:

  1. Is there a reason people haven't reported this to coverage.py before? Is there a existing known way to get coverage reports on this kind of code?
  2. What is a stable public API for getting the transformation mapping?
  3. Would TensorFlow be interested in maintaining a coverage.py plugin to make this work properly?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.