Conversion to py.test

Converted 70% of `runtest.py` to more conventional Python tests using the `py.test` testing tool (see http://pytest.org/latest/index.html for details).