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

modules in cwd can't be --omitted #33

Closed
nedbat opened this issue Nov 16, 2009 · 4 comments
Closed

modules in cwd can't be --omitted #33

nedbat opened this issue Nov 16, 2009 · 4 comments
Labels
bug Something isn't working

Comments

@nedbat
Copy link
Owner

nedbat commented Nov 16, 2009

Originally reported by Danek Duvall (Bitbucket: dhduvall, GitHub: dhduvall)


I'm having trouble with --omit. The code that we're testing is off in $PROTO, and the test suite itself is in the current directory, in directories "api" and "cli". So I'm running coverage as

    coverage html --omit $PROTO/mod1,$PROTO/mod2,api,cli

but that doesn't actually exclude api and cli from the report. I also tried with $PWD/api,$PWD/cli, but no dice.

In code_unit_factory(), we match cu.name against "prefix", but that prefix has been turned into an absolute pathname, so the .startswith() call doesn't return true, and we end up putting them into the final list.

If we check against cu.filename instead of cu.name, it appears to work correctly, but I'm not sure if that breaks something else.


@nedbat
Copy link
Owner Author

nedbat commented Nov 19, 2009

Original comment by Anonymous


Bump!

@nedbat
Copy link
Owner Author

nedbat commented Nov 19, 2009

Original comment by Anonymous


I wonder, how --omit was supposed to work in the first place, with that abs_file()...

@nedbat
Copy link
Owner Author

nedbat commented Nov 20, 2009

Sadly, I'm starting to wonder the same thing!

@nedbat
Copy link
Owner Author

nedbat commented Nov 20, 2009

Danek's change is a simple and good fix: <<changeset 24db72e45ad8 (bb)>>.

@nedbat nedbat closed this as completed Nov 20, 2009
@nedbat nedbat added major bug Something isn't working labels Jun 23, 2018
agronholm added a commit to agronholm/coveragepy that referenced this issue Aug 16, 2020
agronholm added a commit to agronholm/coveragepy that referenced this issue Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant