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

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

Closed
nedbat opened this issue Jul 7, 2017 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@nedbat
Copy link
Owner

nedbat commented Jul 7, 2017

Originally reported by David Sanders (Bitbucket: rapilabs, GitHub: rapilabs)


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].


@nedbat
Copy link
Owner Author

nedbat commented Jul 7, 2017

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?

@nedbat
Copy link
Owner Author

nedbat commented Jul 7, 2017

Original comment by David Sanders (Bitbucket: rapilabs, GitHub: rapilabs)


I like your reasoning! :)

@nedbat
Copy link
Owner Author

nedbat commented Oct 21, 2017

Fixed in e9937fd58c19 (bb)

@nedbat
Copy link
Owner Author

nedbat commented Nov 5, 2017

This has shipped in 4.4.2

@nedbat nedbat closed this as completed Nov 5, 2017
@nedbat nedbat added trivial bug Something isn't working labels Jun 23, 2018
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