Inherited from the wrong class. Try inheriting from setuptools.command.test.test , which itself is a subclass of setuptools.Command , but has additional methods for handling your dependencies. Then you want to override run_tests() , not run() .
So something like:
from setuptools.command.test import test as TestCommand class MyTestCommand(TestCommand): description = 'run linters, tests and create a coverage report' user_options = [] def run_tests(self): self._run(['pep8', 'package', 'test', 'setup.py']) self._run(['py.test', '--cov=package', 'test']) def _run(self, command): try: subprocess.check_call(command) except subprocess.CalledProcessError as error: print('Command failed with exit code', error.returncode) sys.exit(error.returncode) if __name__ == '__main__': setuptools.setup(
source share