Misc fixes

A number of small fixes previously overlooked.

The unit test respect some environment variables that modify py.test invocation:
* `PYTEST_VERBOSE` adds `-v`
* `PYTEST_EXITFIRST` adds `-x`
* `PYTEST_NOCAPTURE` adds `-s`
* `PYTEST_TBNATIVE` adds `--tb=native`

These are used by buildbot.