The solution I came up with finally is:
- Have a module for the tests which fixes the global data, including the hostname, and provides my TestCase class (I added an
assertLoadsOk
method to simply check for the HTTP status code). - This module does commandline processing as well:
- It checks for its own options
- and removes them from the argument vector (
sys.argv
). - When finding an "unknown" option, stop processing the options, and leave the rest to the testrunner.
- The commandline processing happens on
import
, before initializing my TestCase class.
It works well for me ...