Clean up non-I/O dm test code and data

Also fix pep8/flake8 errors.