Skip to content

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

Closed
@nedbat

Description

@nedbat

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.


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions