1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Added manage.py test --testrunner tests.

This commit is contained in:
Matthijs Kooijman 2018-08-23 09:22:05 -04:00 committed by Tim Graham
parent 108c04f572
commit 69071e7f51

View File

@ -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')