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

Follow-Up: Sanic generated code makes coverage throw "couldn't parse" warnings #2702

Closed
1 task done
rbm-radius opened this issue Mar 2, 2023 · 1 comment
Closed
1 task done
Labels

Comments

@rbm-radius
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Running coverage run; coverage xml on a Sanic app causes warnings about unparseable code that seem related to code generated by Sanic.

As an example:

warning: "No source for code: _run_response_middleware (couldnt-parse)

Code snippet

A full example is provided here:

https://github.com/rogthefrog/sanic-coverage-example

Expected Behavior

Warnings should not be issued against code that doesn't exist.

How do you run Sanic?

Sanic CLI

Operating System

MacOS Monterey 12.4

Sanic Version

22.12.0

Additional context

This is a follow-up to #2345 per request from @ahopkins

Thank you.

@rbm-radius rbm-radius added the bug label Mar 2, 2023
@ahopkins
Copy link
Member

ahopkins commented Mar 20, 2023

Thanks for putting together the example. Makes it much easier to help you. ❤️

I would suggest adding this:

from os import environ

...

if "COVERAGE_RUN" in environ:
    app.config.TOUCHUP = False

I confirmed with your test repo that it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants