diff options
| author | Matthijs Kooijman <matthijs@stdin.nl> | 2018-08-23 09:22:05 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-08-23 10:12:03 -0400 |
| commit | 69071e7f518955e242ad25ae9490ddb1b3bb8d0b (patch) | |
| tree | 3b7f03b4f3605545e63492addd9c193db8d01300 /tests | |
| parent | 108c04f572ccca74258c4d2024aef61270a5b083 (diff) | |
Added manage.py test --testrunner tests.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_runner/tests.py | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py index 65224538e9..eb89ad79f8 100644 --- a/tests/test_runner/tests.py +++ b/tests/test_runner/tests.py @@ -150,8 +150,11 @@ class ManageCommandTests(unittest.TestCase): call_command('test', 'sites', testrunner='test_runner.NonexistentRunner') -class CustomTestRunnerOptionsTests(AdminScriptTestCase): - +class CustomTestRunnerOptionsSettingsTests(AdminScriptTestCase): + """ + Custom runners can add command line arguments. The runner is specified + through a settings file. + """ def setUp(self): settings = { 'TEST_RUNNER': '\'test_runner.runner.CustomOptionsTestRunner\'', @@ -187,6 +190,34 @@ class CustomTestRunnerOptionsTests(AdminScriptTestCase): self.assertOutput(out, 'bar:foo:31337') +class CustomTestRunnerOptionsCmdlineTests(AdminScriptTestCase): + """ + Custom runners can add command line arguments when the runner is specified + using --testrunner. + """ + def setUp(self): + self.write_settings('settings.py') + + def tearDown(self): + self.remove_settings('settings.py') + + def test_testrunner_equals(self): + args = [ + 'test', '--testrunner=test_runner.runner.CustomOptionsTestRunner', + '--option_a=bar', '--option_b=foo', '--option_c=31337' + ] + out, err = self.run_django_admin(args, 'test_project.settings') + self.assertNoOutput(err) + self.assertOutput(out, 'bar:foo:31337') + + def test_no_testrunner(self): + args = ['test', '--testrunner'] + out, err = self.run_django_admin(args, 'test_project.settings') + self.assertIn('usage', err) + self.assertNotIn('Traceback', err) + self.assertNoOutput(out) + + class Ticket17477RegressionTests(AdminScriptTestCase): def setUp(self): self.write_settings('settings.py') |
