3

I have built unittests for my code and everything works fine when running them from vscode. Even running coverage run runs successfully. But when I try to run coverage report I get the following output:

No source for code: 'C:\Users\XXX\AppData\Local\Temp\1\__autograph_generated_file4ilniiln.py'

I found out that this happens exactly when I add a test case which contains tensorflow.keras.Model.fit function. If I remove tensorflow.keras.Model.fit then this message does not appear for coverage report command.

How can I solve this issue?

1 Answer 1

3

Tensorflow rewrites your code and runs it from a new location. I need some assistance to get it working properly in coverage.py. See this issue for details: https://github.com/nedbat/coveragepy/issues/856

You can try using the -i flag to coverage report to ignore files it can't find. I don't know if you will still get complete data or not.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the response. Reading your link (and referenced links in it), I came along tf.config.experimental_run_functions_eagerly(True) which seems to work (at least for my cases).
Is your code public? I'd be interested in a reproducible case that I can experiment with.
Unfortunately it is not public available.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.