From 42c375cbd91a7be9332e26f9b2cf1c8b8fb8ac5f Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sat, 29 Sep 2012 19:41:21 +0100 Subject: [PATCH] Allow passing options to `tests/runtests.py` from `python setup.py test`. --- setup.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index c69fd7ccef..69610381ae 100755 --- a/setup.py +++ b/setup.py @@ -36,10 +36,12 @@ exec(compile(open(salt_version).read(), salt_version, 'exec')) class TestCommand(Command): description = 'Run tests' - user_options = [] + user_options = [ + ('runtests-opts=', 'R', 'Command line options to pass to runtests.py') + ] def initialize_options(self): - pass + self.runtests_opts = None def finalize_options(self): pass @@ -49,7 +51,10 @@ class TestCommand(Command): self.run_command('build') build_cmd = self.get_finalized_command('build_ext') runner = os.path.abspath('tests/runtests.py') - test_cmd = 'python %s' % runner + test_cmd = 'python {0}'.format(runner) + if self.runtests_opts: + test_cmd += ' {0}'.format(self.runtests_opts) + print("running test") test_process = Popen( test_cmd, shell=True,