Using --rcfile=/path/to/tox.ini uses [run] section rather than [coverage:run]

Issue #588 resolved
David Sanders created an issue

Was trying to get a setup for a project happening where tox.ini was one directory up from where coverage was being run. Found it was necessary to specify the location with --rcfile but surprsingly found that the section must be named [run].

Comments (5)

  1. Ned Batchelder repo owner

    Interesting case. When you specify an exact filename, the config code thinks you are pointing to a .coveragerc file, and reads it as such. Only if you let the filename default, does it know it is looking at a tox.ini.

    There are a few ways we could change this behavior: 1. Always look for [coverage:run] before [run], no matter how we got to the file. 2. Let you specify a directory with --rcfile, then it will know it is looking at a tox.ini file because it cycled through the filenames looking for the file 3. Check the filename of the path, and if it's "tox.ini", know to look for [coverage:run]

    I like 3 the least. 2 is interesting because we've never allowed directories before, so it (probably) won't break anything. 1 seems most appealing, since it seems bullet-proof. Why wouldn't we read a [coverage:run] section if we found it in a .coveragerc file?

  2. Log in to comment