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

os.chdir() causes .coverage file misplacement #24

Closed
nedbat opened this issue Sep 15, 2009 · 3 comments
Closed

os.chdir() causes .coverage file misplacement #24

nedbat opened this issue Sep 15, 2009 · 3 comments
Labels
bug Something isn't working

Comments

@nedbat
Copy link
Owner

nedbat commented Sep 15, 2009

Originally reported by schafer (Bitbucket: schafer, GitHub: schafer)


The following file contents will produce an empty coverage report (create directory "testsub" first):

  • import os
  • print "statement 1"
  • os.chdir("testsub")
  • print "statement 2"

Issue tested and exists in both 3.01 and 2.80-2 (current for Ubuntu 9.04 repository).

Workaround: specify an absolute file location via COVERAGE_FILE. This provides correct output in 3.01, but not in 2.80-2.

Adjusting the .coverage filename to include an absolute path via something like filename = os.path.join( os.path.abspath( os.path.split(filename)[0]), os.path.split(filename)[1]) would probably resolve.


@nedbat
Copy link
Owner Author

nedbat commented Sep 15, 2009

Thanks for the report. Fixed in <<changeset ed5c6781f9c8 (bb)>>.

@nedbat
Copy link
Owner Author

nedbat commented Sep 15, 2009

Original comment by schafer (Bitbucket: schafer, GitHub: schafer)


Pulled tip and confirmed resolved.

@nedbat nedbat closed this as completed Sep 15, 2009
@nedbat
Copy link
Owner Author

nedbat commented Feb 25, 2010

Removing version: 3.0.1 (automated comment)

@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
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