Allow environment variables to be referenced in rc files · Issue #97 · nedbat/coveragepy (original) (raw)

Originally reported by Geoff Bache (Bitbucket: geoffbache, GitHub: Unknown)


In the process of integrating my test tool TextTest more closely with coverage.py, and trying to make use of rc files, I noticed I would either need to autogenerate them for every test run or be able to refer to environment variables in them.

I'm thinking particularly of the "data_file" and "source" settings. TextTest has its own temporary path structure where it runs tests, which it provides an environment variable for, and it would make sense to point "data_file" at that. Likewise, it knows where the source is, and sets an environment variable for that also. It would be nice to have a static coveragerc file for TextTest rather than needing to generate it each time.

This would be a one-line change: with this line

#!python

cp = configparser.ConfigParser(defaults=os.environ)

in config.py inserted.