DeprecationWarning: You passed a bytestring as `filenames`

Issue #530 resolved
Former user created an issue

I am using coverage (version 4.0) with nose (1.3.7) for my test suite on Travis CI.

Every time I am using the coverage script (erase, run, report, ...) I get this error raised:

coverage run --rcfile=.coveragerc -m nose -c .noserc
/home/travis/virtualenv/python2.7.12/lib/python2.7/site-packages/coverage/ DeprecationWarning: You passed a bytestring as `filenames`. This will not work on Python 3. Use `cp.read_file()` or switch to using Unicode strings across the board.
  return, filename, **kwargs)

I do not understand what it means and where it comes from ...

I run this command:

coverage run --rcfile=.coveragerc -m nose -c .noserc

My coverage configuration file is:

;fail_under = 100
exclude_lines =
    pragma: no cover
    def __repr__
    if self.debug:
    if settings.DEBUG
    raise AssertionError
    raise NotImplementedError
    if 0:
    if __name__ == .__main__.:

branch = True
source =

omit =

source =

My nose configuration file is:

; Uncomment to have the stdout
; Uncomment to remove the python logger from output (except for console logs)

; Only 1 running test process
; Process timeout is 5 minutes
; Restart worker process (avoid memory leak)

Comments (10)

  1. Ned Batchelder repo owner

    @mohierf What version of Python are you running under? Can you try upgrading to the latest version of (4.2)?

  2. mohierf

    I am running Python 2.6 and 2.7. I will give a try with the 4.2 version and report if any problem here.

  3. mohierf

    I used the 4.2 version on my Travis build. No warning with python2.6. But with python2.7 I still have the same warning message

  4. Ned Batchelder repo owner

    @mohierf Can you give me a link to one of your failing Travis builds? It seems like there's a warning flag enabled that isn't on by default?

  5. Ned Batchelder repo owner

    Thanks, I can see that this line is in the Travis job:

    $ export PYTHONWARNINGS=all

    Aren't you bothered by the slew of other warnings you're getting? Why enable all these warnings? I don't need Python to tell me that my Python 2 code will behave differently in Python 3. I've already accounted for that.

  6. mohierf

    Thank you for the feedback and the hint for Python warnings, I did not know about this Travis feature. It seems that it is enabled as a default ... but I do not know yet why. I will investigate this.

  7. Log in to comment