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
Missed lines with asyncio & context managers #441
Comments
@hynek any chance you've come up with more information about this? Can you provide explicit instructions for reproducing it, even if it's a particular hash in your repo with details of how to run the tests? |
Original comment by Hynek Schlawack (Bitbucket: hynek, GitHub: hynek) I was able to strip it down reasonably: https://ox.cx/stuff/sscce.tbz2 PreparationsYou need a postgres DB that you have to configure in This DB needs a single table: CREATE TABLE "public"."tokens" (
"token" text NOT NULL COLLATE "default",
"system" text NOT NULL COLLATE "default",
"purpose" text NOT NULL COLLATE "default",
"user_id" int4 NOT NULL,
"created" timestamp(6) WITH TIME ZONE DEFAULT timezone('UTC'::text, now()),
"valid" bool NOT NULL DEFAULT true
)
WITH (OIDS=FALSE);
ALTER TABLE "public"."tokens" ADD PRIMARY KEY ("token") NOT DEFERRABLE INITIALLY IMMEDIATE; Reproduction
You should be seeing If you add a Let me know if you need something. |
I haven't had a chance to reproduce this yet, but it sure looks like a duplicate of #146. Would you mind trying 4.1b1 to see if it is fixed? https://pypi.python.org/pypi/coverage/4.1b1 |
Original comment by Hynek Schlawack (Bitbucket: hynek, GitHub: hynek) Sadly, 4.1b1 seems worse. I’ve updated, did an I’m getting the following output:
In htmlcov: |
Hmm, the class docstring is confusing me: I had this happen in code of mine, and the first change I made after b1 was to change it again. About the await's: it looks like I need to understand them better. I'll try your code. |
I'm understanding |
This will be fixed in 4.1b2. |
Original comment by Hynek Schlawack (Bitbucket: hynek, GitHub: hynek) OK I’m afraid I’ve found another similar case: try:
foo
except Something:
raise # <-- can't get this covered If you wonder what that construct is good for: I want to whitelist certain exceptions that can pass unaltered but wrap all others. Should I reopen or open a new issue? |
A new issue would be best, thanks. |
Originally reported by Hynek Schlawack (Bitbucket: hynek, GitHub: hynek)
I have a rather odd problem I cannot reproduce in clean room.
I have a rather simple class and method:
https://gist.github.com/hynek/3ad620d07a7999f4daf5
Line 21 – or any line before the
except
– is not reported as covered. Even if it’s a print statement and see its output.It seems to be related with the context manager because it's a) always the last line and b) when I rewrite it as https://gist.github.com/hynek/cfe2cc32f337e2676466 the coverage works just fine.
I’m sorry I can’t be more helpful but I’m confused as hell myself. The pool is from aiopg and seems to be semi-magical: https://github.com/aio-libs/aiopg/blob/master/aiopg/pool.py#L302 so dunno if that helps…
The text was updated successfully, but these errors were encountered: