Example #1
0
def runtests(*verbosity):
    import django
    django.setup()

    from django.conf import settings, global_settings
    from django.core.management.commands.test import Command

    settings.STATICFILES_STORAGE = global_settings.STATICFILES_STORAGE

    test_command = Command()
    verbosity = int(verbosity[0] if verbosity else 2)
    test_command.execute(*default_test_apps, verbosity=verbosity)
Example #2
0
def runtests(*verbosity):
    import django
    django.setup()

    from django.conf import settings, global_settings
    from django.core.management.commands.test import Command

    settings.STATICFILES_STORAGE = global_settings.STATICFILES_STORAGE

    test_command = Command()
    verbosity = int(verbosity[0] if verbosity else 2)
    test_command.execute(*default_test_apps, verbosity=verbosity)
Example #3
0
    def handle(self, *test_labels, **options):
        settings.TEST_WSGI_PORT = options.pop('http_port', 8888)
        settings.TEST_DB_SUFFIX = options.pop('db_suffix', "_dev_tools")
        settings.REUSE_TEST_DB = options.pop('reuse_db', False)
        if hasattr(settings, 'WSGI_TEST_RUNNER'):
            settings.TEST_RUNNER = settings.WSGI_TEST_RUNNER
        else:
            settings.TEST_RUNNER = 'djangodevtools.wsgitest.TrasactionWsgiTestRunner'
#        #settings.PASSWORD_VALIDITY = None
#        #settings.PASSWORD_ALERT = 80 # days
#        #settings.PASSWORD_FORCE_CHANGE_FIRST_LOGIN = False
        TestCommand.handle(self, *test_labels, **options)
Example #4
0
 def test_check_default_verbosity(self):
     """
     If no verbosity is passed, default value is set
     """
     dr = djangorunner.DjangoRunner()
     dr.setup_test_environment = MagicMock()
     dr.setup_databases = MagicMock()
     dr.teardown_databases = MagicMock()
     dr.teardown_test_environment = MagicMock()
     from django.core.management.commands.test import Command as TestCommand
     test_command = TestCommand()
     test_command.test_runner = "green.djangorunner.DjangoRunner"
     parser = ArgumentParser()
     test_command.add_arguments(parser)
     args = parser.parse_args()
     self.assertEqual(args.verbose, -1)
Example #5
0
 def test_check_verbosity_argument_recognised(self):
     """
     Ensure that the python manage.py test command
     recognises the --green-verbosity flag
     """
     dr = djangorunner.DjangoRunner()
     dr.setup_test_environment = MagicMock()
     dr.setup_databases = MagicMock()
     dr.teardown_databases = MagicMock()
     dr.teardown_test_environment = MagicMock()
     from django.core.management.commands.test import Command as TestCommand
     test_command = TestCommand()
     test_command.test_runner = "green.djangorunner.DjangoRunner"
     parser = ArgumentParser()
     test_command.add_arguments(parser)
     args = parser.parse_args()
     self.assertIn('verbose', args)
Example #6
0
    def test_hex_values(self):
        # Test hex values
        self.failUnlessEqual('#000000', _get_color('!000000', 'BG'))
        self.failUnlessEqual('#FFFFFF', _get_color('!ffffff', 'BG'))

    def test_short_hex_values(self):
        # Shorts
        self.failUnlessEqual('#001122', _get_color('!012', 'BG'))
        self.failUnlessEqual('#AABBCC', _get_color('!abc', 'BG'))

    def test_invalid_hex_values(self):
        # invalids
        self.failUnlessEqual('grey', _get_color('!xyz', 'TEXT'))
        self.failUnlessEqual('grey', _get_color('!1234567', 'BORDER'))

    def test_invalid_type(self):
        # Test exceptions
        # invalid type
        self.failUnlessRaises(KeyError, _get_color, '', 'TYPE')
        self.failUnlessRaises(KeyError, _get_color, '!invalid', 'TYPE')


if __name__ == '__main__':
    import os
    from django.core.management.commands.test import Command

    test_argv = [os.sys.argv[0], '', 'dummyimage'] + os.sys.argv[1:]
    test_command = Command()
    test_command.run_from_argv(test_argv)