Fix AttributeError when calling 'setup.py test'