Added test runner options to command parser #207

Merged
merged 2 commits into from Mar 5, 2014

Projects

None yet

2 participants

@maciej-gol
Contributor

This pull request allows users to access test runner's additional options, if any. In particular, used with django's DiscoverRunner's --top-level-directory and --pattern options.

@kmmbvnr kmmbvnr commented on the diff Mar 4, 2014
django_jenkins/management/commands/__init__.py
@@ -78,13 +80,7 @@ def handle(self, *test_labels, **options):
# run
test_runner_cls = get_runner()
- test_runner = test_runner_cls(
- output_dir=options['output_dir'],
- interactive=options['interactive'],
- debug=options['debug'],
- verbosity=int(options.get('verbosity', 1)),
- with_reports=options.get('with_reports', True),
- test_all=options.get('test_all', False))
@kmmbvnr
kmmbvnr Mar 4, 2014 Owner

This will miss django_jenkins specific options with_reports and test_all

@maciej-gol
maciej-gol Mar 4, 2014 Contributor

@kmmbvnr , test_all is covered by a command option of TaskListCommand. Regarding with_reports - it's only parsed when calling jtest command where it is explicitly added as command option.

@kmmbvnr kmmbvnr commented on the diff Mar 4, 2014
django_jenkins/management/commands/__init__.py
@@ -109,6 +105,14 @@ def create_parser(self, *args):
"""
parser = super(TaskListCommand, self).create_parser(*args)
+ test_runner_class = get_runner()
+ if hasattr(test_runner_class, 'option_list'):
@kmmbvnr
kmmbvnr Mar 4, 2014 Owner

looks too dangerous. I think it's better just add missing options to django_jenkins comand explicitly

@maciej-gol
maciej-gol Mar 4, 2014 Contributor

@kmmbvnr , why would it seem dangerous? It makes it possible to create called-command-independent runners that can be configured using user-defined options without unnecessarily subclassing any django_jenkins commands.

@kmmbvnr
Owner
kmmbvnr commented Mar 5, 2014

Ok, let's try

@kmmbvnr kmmbvnr merged commit 52d0474 into kmmbvnr:master Mar 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment