I use coverage to run tests and I would like to issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str. (i.e. running python -bb
). Is there a way to run coverage like this or to activate bytes_warning progamatically?
Interesting, I had never seen -bb
before, and it's too bad Python doesn't provide an environment variable that also controls it.
You can run coverage as a module, which lets you access the Python command line you want:
$ python -bb -m coverage run my_program.py
I think this will do the right thing for you.