Ejemplo n.º 1
0
def main():
    """
    Standalone django model test with a 'memory-only-django-installation'.
    You can play with a django model without a complete django app installation.
    http://www.djangosnippets.org/snippets/1044/
    """
    settings.configure(
        INSTALLED_APPS=(
            'django.contrib.auth',
            'django.contrib.sessions',
            'django.contrib.contenttypes',
            'upyun',
        ),
        DATABASES={
            'default': {
                'ENGINE': 'django.db.backends.sqlite3',
                'NAME': ':memory:',
            }
        },
        ROOT_URLCONF='beproud.django.authutils.tests.test_urls',
        DEFAULT_FILE_STORAGE='django_upyun.UpYunStorage',
        UPYUN_USERNAME=os.getenv('UPYUN_USERNAME'),
        UPYUN_PASSWORD=os.getenv('UPYUN_PASSWORD'),
        UPYUN_BUCKET=os.getenv('UPYUN_BUCKET'),
        MEDIA_URL="http://%s.b0.upaiyun.com/media/" % os.getenv('UPYUN_BUCKET'),
        STATIC_URL="http://%s.b0.upaiyun.com/static/" % os.getenv('UPYUN_BUCKET')
    )
    django.setup()
    from django.test.runner import DiscoverRunner
    test_runner = DiscoverRunner(verbosity=1)

    failures = test_runner.run_tests(['upyun'])
    sys.exit(failures)
Ejemplo n.º 2
0
    def run_tests(self):
        """
        Fire up the Django test suite
        """
        settings.configure(
            DEBUG = True,
            DATABASES = {
                'default': {
                    'ENGINE': 'django.db.backends.sqlite3',
                    'NAME': os.path.join(self.DIRNAME, 'database.db'),
                    'USER': '',
                    'PASSWORD': '',
                    'HOST': '',
                    'PORT': '',
                }
            },
            LOGGING = {
                'version': 1,
                'formatters': {'simple': {'format': '%(levelname)s %(asctime)s %(name)s %(message)s'}},
                'handlers': {'console': {'class': 'logging.StreamHandler', 'formatter': 'simple'}},
                'loggers': {'screamshot': {'handlers': ['console'], 'level': 'DEBUG'}}
            },
            INSTALLED_APPS = self.INSTALLED_APPS + self.apps
        )

        django.setup()

        test_runner = DiscoverRunner(verbosity=1)

        failures = test_runner.run_tests(self.apps)
        if failures: # pragma: no cover
            sys.exit(failures)
Ejemplo n.º 3
0
 def test_reverse(self):
     """
     Reverse should reorder tests while maintaining the grouping specified
     by ``DiscoverRunner.reorder_by``.
     """
     runner = DiscoverRunner(reverse=True)
     suite = runner.build_suite(
         test_labels=('test_runner_apps.sample', 'test_runner_apps.simple'))
     self.assertIn('test_runner_apps.simple', next(iter(suite)).id(),
                   msg="Test labels should be reversed.")
     suite = runner.build_suite(test_labels=('test_runner_apps.simple',))
     suite = tuple(suite)
     self.assertIn('DjangoCase', suite[0].id(),
                   msg="Test groups should not be reversed.")
     self.assertIn('SimpleCase', suite[4].id(),
                   msg="Test groups order should be preserved.")
     self.assertIn('DjangoCase2', suite[0].id(),
                   msg="Django test cases should be reversed.")
     self.assertIn('SimpleCase2', suite[4].id(),
                   msg="Simple test cases should be reversed.")
     self.assertIn('UnittestCase2', suite[8].id(),
                   msg="Unittest test cases should be reversed.")
     self.assertIn('test_2', suite[0].id(),
                   msg="Methods of Django cases should be reversed.")
     self.assertIn('test_2', suite[4].id(),
                   msg="Methods of simple cases should be reversed.")
     self.assertIn('test_2', suite[8].id(),
                   msg="Methods of unittest cases should be reversed.")
def setup():
    global test_runner
    global old_config

    test_runner = DiscoverRunner()
    test_runner.setup_test_environment()
    old_config = test_runner.setup_databases()
Ejemplo n.º 5
0
 def add_arguments(cls, parser):
     DiscoverRunner.add_arguments(parser)
     parser.add_argument(
         '--mayan-apps', action='store_true', default=False,
         dest='mayan_apps',
         help='Test all Mayan apps that report to have tests.'
     )
Ejemplo n.º 6
0
def run_tests():
    sys.stdout.write(
        "\nRunning spirit test suite, using settings %(settings)r\n\n" %
        {"settings": os.environ['DJANGO_SETTINGS_MODULE']})
    test_runner = DiscoverRunner()
    failures = test_runner.run_tests([])
    sys.exit(failures)
Ejemplo n.º 7
0
def run_tests():
    import django
    from django.conf import global_settings
    from django.conf import settings
    settings.configure(
        INSTALLED_APPS=[
            'corsheaders',
        ],
        DATABASES={
            'default': {
                'ENGINE': 'django.db.backends.sqlite3',
                'TEST_NAME': ':memory:',
            },
        },
        MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES + (
            'corsheaders.middleware.CorsMiddleware',),
    )
    if hasattr(django, 'setup'):
        django.setup()

    try:
        from django.test.runner import DiscoverRunner as Runner
    except ImportError:
        from django.test.simple import DjangoTestSuiteRunner as Runner

    test_runner = Runner(verbosity=1)
    return test_runner.run_tests(['corsheaders'])
Ejemplo n.º 8
0
def run_tests():
    import django
    from django.conf import settings, global_settings
    settings.configure(
        # Minimal django settings
        DATABASES={
            'default': {
                'ENGINE': 'django.db.backends.sqlite3',
                'TEST_NAME': ':memory:',
            },
        },
        MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES,
        INSTALLED_APPS=['etcd_settings'],
        DJES_DEV_PARAMS=None,
        DJES_REQUEST_GETTER=None,
        DJES_ENV='dev',
        DJES_ETCD_DETAILS=None,
        DJES_WSGI_FILE=None
        # DJES_ETCD_DETAILS=dict(host='localhost', port=4000, protocol='http',
        #                        prefix='/config/my-django-app')
    )
    if hasattr(django, 'setup'):
        django.setup()

    try:
        from django.test.runner import DiscoverRunner as Runner
    except ImportError:
        from django.test.simple import DjangoTestSuiteRunner as Runner

    test_runner = Runner(verbosity=1)
    return test_runner.run_tests(['tests'])
Ejemplo n.º 9
0
    def _tests(self):

        settings.configure(
            DEBUG=True,
            DATABASES={
                'default': {
                    'ENGINE': 'django.db.backends.sqlite3',
                    'NAME': os.path.join(self.DIRNAME, 'database.db'),
                    'USER': '',
                    'PASSWORD': '',
                    'HOST': '',
                    'PORT': '',
                }
            },
            INSTALLED_APPS=self.INSTALLED_APPS + self.apps,
            MIDDLEWARE_CLASSES=self.MIDDLEWARE_CLASSES,
            ROOT_URLCONF='helpdesk.tests.urls',
            STATIC_URL='/static/',
            TEMPLATES=self.TEMPLATES
        )

        from django.test.runner import DiscoverRunner
        test_runner = DiscoverRunner(verbosity=1)
        django.setup()

        failures = test_runner.run_tests(self.apps)
        if failures:
            sys.exit(failures)
Ejemplo n.º 10
0
    def test_add_arguments_debug_mode(self):
        parser = ArgumentParser()
        DiscoverRunner.add_arguments(parser)

        ns = parser.parse_args([])
        self.assertFalse(ns.debug_mode)
        ns = parser.parse_args(["--debug-mode"])
        self.assertTrue(ns.debug_mode)
def runtests(*test_args):
    from django.test.runner import DiscoverRunner

    parent = dirname(abspath(__file__))
    sys.path.insert(0, parent)
    test_runner = DiscoverRunner(verbosity=1, interactive=True)
    failures = test_runner.run_tests(test_args)
    sys.exit(failures)
Ejemplo n.º 12
0
def run_tests():
    """Run the test suite."""
    import django
    from django.test.runner import DiscoverRunner
    django.setup()
    test_runner = DiscoverRunner(verbosity=2, interactive=False)
    failures = test_runner.run_tests(['.'])
    sys.exit(bool(failures))
Ejemplo n.º 13
0
def runtests(*test_args, **kwargs):
    if not test_args:
        test_args = ['djangobb_forum']
    parent = dirname(abspath(__file__))
    sys.path.insert(0, parent)
    test_runner = DiscoverRunner(verbosity=kwargs.get('verbosity', 1), interactive=kwargs.get('interactive', False), failfast=kwargs.get('failfast'))
    failures = test_runner.run_tests(test_args)
    sys.exit(failures)
Ejemplo n.º 14
0
def runtests(options={}):
    parent = dirname(abspath(__file__))
    sys.path.insert(0, parent)
    django.setup()
    setup_test_environment()
    test_runner = DiscoverRunner(**options)
    failures = test_runner.run_tests(['django_elect'])
    sys.exit(failures)
Ejemplo n.º 15
0
def runtests(*args):
    parent = dirname(abspath(__file__))
    sys.path.insert(0, parent)
    testrunner = DjangoTestRunner()
    if not args:
        args = None
    failures = testrunner.run_tests(args)
    sys.exit(failures)
Ejemplo n.º 16
0
def setUpModule():
    if django is None:
        raise unittest.SkipTest(SKIPTEST_TEXT)
    setup_test_environment()
    global DJANGO_RUNNER
    global DJANGO_RUNNER_STATE
    DJANGO_RUNNER = DiscoverRunner()
    DJANGO_RUNNER_STATE = DJANGO_RUNNER.setup_databases()
Ejemplo n.º 17
0
def setUpModule():
    django_test_utils.setup_test_environment()
    runner = DjangoTestSuiteRunner()
    runner_state = runner.setup_databases()
    test_state.update({
        'runner': runner,
        'runner_state': runner_state,
    })
Ejemplo n.º 18
0
def setup():
    from django.test.runner import DiscoverRunner
    global test_runner
    global old_config

    test_runner = DiscoverRunner()
    test_runner.setup_test_environment()
    old_config = test_runner.setup_databases()
Ejemplo n.º 19
0
def runtests():
    setup_test_environment()

    parent = os.path.dirname(os.path.abspath(__file__))
    sys.path.insert(0, parent)

    runner = DiscoverRunner(verbosity=1, interactive=True, failfast=False)
    failures = runner.run_tests(())
    sys.exit(failures)
Ejemplo n.º 20
0
def runtests(*test_args, **kwargs):
    if not test_args:
        test_args = ['countries_field']

    django.setup()
    test_runner = DiscoverRunner(**kwargs)

    failures = test_runner.run_tests(test_args)
    sys.exit(failures)
Ejemplo n.º 21
0
def runtests(*test_args):
    if not test_args:
        test_args = ["fixture_generator.tests"]
    parent = dirname(abspath(__file__))
    sys.path.insert(0, parent)
    setup()
    runner = DiscoverRunner(verbosity=2, interactive=True, failfast=False)
    failures = runner.run_tests(test_args)
    sys.exit(failures)
Ejemplo n.º 22
0
def run_tests(*test_args):

    # Run tests
    test_runner = DiscoverRunner(verbosity=1)

    failures = test_runner.run_tests(test_args)

    if failures:
        sys.exit(failures)
Ejemplo n.º 23
0
def runtests(*test_args):
    # Setup settings
    if not settings.configured:
        settings.configure(**test_settings.__dict__)
    setup()
    test_runner = TestRunner(verbosity=1)
    failures = test_runner.run_tests(['dpaste'])
    if failures:
        sys.exit(failures)
Ejemplo n.º 24
0
def run_tests():
    # Modify path
    parent = os.path.dirname(os.path.abspath(__file__))
    sys.path.insert(0, parent)

    # Run tests
    test_runner = DiscoverRunner(verbosity=2)
    failures = test_runner.run_tests(['tests'])
    sys.exit(failures)
Ejemplo n.º 25
0
 def test_setup_aliased_default_database(self):
     """
     Test that setup_datebases() doesn't fail when 'default' is aliased
     """
     tested_connections = db.ConnectionHandler({"default": {"NAME": "dummy"}, "aliased": {"NAME": "dummy"}})
     with mock.patch("django.test.utils.connections", new=tested_connections):
         runner_instance = DiscoverRunner(verbosity=0)
         old_config = runner_instance.setup_databases()
         runner_instance.teardown_databases(old_config)
Ejemplo n.º 26
0
def runtests():
    if not settings.configured:
        settings.configure(**DEFAULT_SETTINGS)

    django.setup()

    test_runner = DiscoverRunner(verbosity=1, interactive=True, failfast=False)
    failures = test_runner.run_tests(['tests'])
    sys.exit(bool(failures))
Ejemplo n.º 27
0
 def test_setup_databases(self):
     """
     Test that setup_databases() doesn't fail with dummy database backend.
     """
     tested_connections = db.ConnectionHandler({})
     with mock.patch("django.test.utils.connections", new=tested_connections):
         runner_instance = DiscoverRunner(verbosity=0)
         old_config = runner_instance.setup_databases()
         runner_instance.teardown_databases(old_config)
Ejemplo n.º 28
0
def runtests(*test_args):
    # Setup settings
    if not settings.configured:
        from memcache_status.tests.testapp import settings as TEST_SETTINGS
        settings.configure(**TEST_SETTINGS.__dict__)
    setup()
    test_runner = DiscoverRunner(verbosity=1)
    failures = test_runner.run_tests(['memcache_status'])
    if failures:
        sys.exit(failures)
Ejemplo n.º 29
0
    def run_tests():
        print("Running tests against %s database." % db)

        #from django.test.simple import DjangoTestSuiteRunner
        #test_runner = DjangoTestSuiteRunner(verbosity=1, failfast=False)
        from django.test.runner import DiscoverRunner
        test_runner = DiscoverRunner(verbosity=1, failfast=False)
        failures = test_runner.run_tests(['django_database_constraints', ])
        if failures: #pragma no cover
            sys.exit(failures)
Ejemplo n.º 30
0
def runtests():
    parent = os.path.dirname(os.path.abspath(__file__))
    sys.path.insert(0, parent)

    django.setup()

    runner = DiscoverRunner(verbosity=1, interactive=True,
                            failfast=bool(os.environ.get('FAILFAST')))
    failures = runner.run_tests(())
    sys.exit(failures)
Ejemplo n.º 31
0
settings.configure(
    DEBUG=True,
    DATABASES={'default': {
        'ENGINE': 'django.db.backends.sqlite3',
    }},
    INSTALLED_APPS=('django.contrib.auth', 'django.contrib.contenttypes',
                    'django.contrib.sessions', 'django.contrib.admin',
                    'django_databrowse'),
    MIDDLEWARE_CLASSES=[],
    ROOT_URLCONF='test_urls',
    TEMPLATES=[{
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.contrib.auth.context_processors.auth',
            ]
        }
    }])
from django.test.runner import DiscoverRunner

django.setup()

test_runner = DiscoverRunner(verbosity=1)
failures = test_runner.run_tests([
    'django_databrowse',
])

if failures:
    sys.exit(failures)
Ejemplo n.º 32
0
def runtests(*test_args):
    if not test_args:
        test_args = [default_test_args]
    runner = DjangoTestSuiteRunner(failfast=False)
    failures = runner.run_tests(test_args)
    sys.exit(failures)
Ejemplo n.º 33
0
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals

from django.conf import settings as django_settings
from django.core.management import call_command
from django.test.runner import DiscoverRunner

from .fixtures import *
from .toolbox import Configuration

assert fixtures_registered  # Just to prevent IDE from import removal on optimization.

runner = DiscoverRunner(interactive=False, verbosity=0)
setup_databases = runner.setup_databases
teardown_databases = runner.teardown_databases


def pytest_runtest_setup(item):
    # todo optional db initialization
    item.old_config = setup_databases()


def pytest_runtest_teardown(item, nextitem):
    unset = {}

    old_config = getattr(item, 'old_config', unset)

    if old_config is unset:
        # _teardown will suddenly work even if no _setup has occured
        # e.g. in case of mark.skipif
        return
 def test_overridable_get_test_runner_kwargs(self):
     self.assertIsInstance(DiscoverRunner().get_test_runner_kwargs(), dict)
Ejemplo n.º 35
0
    def test_dotted_test_module(self):
        count = DiscoverRunner().build_suite(
            ['test_runner_apps.sample.tests_sample'], ).countTestCases()

        self.assertEqual(count, 4)
 def test_overridable_test_suite(self):
     self.assertEqual(DiscoverRunner().test_suite, TestSuite)
    def test_dotted_test_class_vanilla_unittest(self):
        count = DiscoverRunner().build_suite(
            ["test_discovery_sample.tests_sample.TestVanillaUnittest"],
        ).countTestCases()

        self.assertEqual(count, 1)
 def test_overridable_test_loader(self):
     self.assertEqual(DiscoverRunner().test_loader, defaultTestLoader)
 def test_overridable_test_runner(self):
     self.assertEqual(DiscoverRunner().test_runner, TextTestRunner)
Ejemplo n.º 40
0
        'odontotheme',
    ))

import django
django.setup()

from opal.core import application


class Application(application.OpalApplication):
    pass


try:
    sys.argv.remove('--failfast')
    failfast = True
except ValueError:
    failfast = False

from django.test.runner import DiscoverRunner
test_runner = DiscoverRunner(verbosity=1, failfast=failfast)
if len(sys.argv) == 2:
    failures = test_runner.run_tests([
        sys.argv[-1],
    ])
else:
    failures = test_runner.run_tests([
        'odontotheme',
    ])
if failures:
    sys.exit(failures)
Ejemplo n.º 41
0
class SetupDatabasesTests(unittest.TestCase):
    def setUp(self):
        self.runner_instance = DiscoverRunner(verbosity=0)

    def test_setup_aliased_databases(self):
        tested_connections = db.ConnectionHandler({
            'default': {
                'ENGINE': 'django.db.backends.dummy',
                'NAME': 'dbname',
            },
            'other': {
                'ENGINE': 'django.db.backends.dummy',
                'NAME': 'dbname',
            }
        })

        with mock.patch(
                'django.db.backends.dummy.base.DatabaseWrapper.creation_class'
        ) as mocked_db_creation:
            with mock.patch('django.test.utils.connections',
                            new=tested_connections):
                old_config = self.runner_instance.setup_databases()
                self.runner_instance.teardown_databases(old_config)
        mocked_db_creation.return_value.destroy_test_db.assert_called_once_with(
            'dbname', 0, False)

    def test_destroy_test_db_restores_db_name(self):
        tested_connections = db.ConnectionHandler({
            'default': {
                'ENGINE': settings.DATABASES[db.DEFAULT_DB_ALIAS]["ENGINE"],
                'NAME': 'xxx_test_database',
            },
        })
        # Using the real current name as old_name to not mess with the test suite.
        old_name = settings.DATABASES[db.DEFAULT_DB_ALIAS]["NAME"]
        with mock.patch('django.db.connections', new=tested_connections):
            tested_connections['default'].creation.destroy_test_db(old_name,
                                                                   verbosity=0,
                                                                   keepdb=True)
            self.assertEqual(
                tested_connections['default'].settings_dict["NAME"], old_name)

    def test_serialization(self):
        tested_connections = db.ConnectionHandler({
            'default': {
                'ENGINE': 'django.db.backends.dummy',
            },
        })
        with mock.patch(
                'django.db.backends.dummy.base.DatabaseWrapper.creation_class'
        ) as mocked_db_creation:
            with mock.patch('django.test.utils.connections',
                            new=tested_connections):
                self.runner_instance.setup_databases()
        mocked_db_creation.return_value.create_test_db.assert_called_once_with(
            verbosity=0, autoclobber=False, serialize=True, keepdb=False)

    def test_serialized_off(self):
        tested_connections = db.ConnectionHandler({
            'default': {
                'ENGINE': 'django.db.backends.dummy',
                'TEST': {
                    'SERIALIZE': False
                },
            },
        })
        with mock.patch(
                'django.db.backends.dummy.base.DatabaseWrapper.creation_class'
        ) as mocked_db_creation:
            with mock.patch('django.test.utils.connections',
                            new=tested_connections):
                self.runner_instance.setup_databases()
        mocked_db_creation.return_value.create_test_db.assert_called_once_with(
            verbosity=0, autoclobber=False, serialize=False, keepdb=False)
Ejemplo n.º 42
0
 def __init__(self, on_run_suite):
     django.setup()
     DiscoverRunner.__init__(self)
     self.on_run_suite = on_run_suite
    def test_discovery_on_package(self):
        count = DiscoverRunner().build_suite(
            ["test_discovery_sample.tests"],
        ).countTestCases()

        self.assertEqual(count, 1)
    def test_empty_test_case(self):
        count = DiscoverRunner().build_suite(
            ["test_discovery_sample.tests_sample.EmptyTestCase"],
        ).countTestCases()

        self.assertEqual(count, 0)
    def test_pattern(self):
        count = DiscoverRunner(
            pattern="*_tests.py",
        ).build_suite(["test_discovery_sample"]).countTestCases()

        self.assertEqual(count, 1)
Ejemplo n.º 46
0
    def test_empty_test_case(self):
        count = DiscoverRunner().build_suite(
            ['test_runner_apps.sample.tests_sample.EmptyTestCase'
             ], ).countTestCases()

        self.assertEqual(count, 0)
Ejemplo n.º 47
0
def run_tests(reverse=False):
    sys.stdout.write(
        "\nRunning spirit test suite, using settings %(settings)r\n\n" %
        {"settings": os.environ['DJANGO_SETTINGS_MODULE']})
    return DiscoverRunner(reverse=reverse).run_tests([])
Ejemplo n.º 48
0
 def test_faulthandler_disabled(self, mocked_enable):
     with mock.patch('faulthandler.is_enabled', return_value=False):
         DiscoverRunner(enable_faulthandler=False)
         mocked_enable.assert_not_called()
Ejemplo n.º 49
0
 def test_buffer_with_parallel(self):
     msg = ('You cannot use -b/--buffer with parallel tests; pass '
            '--parallel=1 to use it.')
     with self.assertRaisesMessage(ValueError, msg):
         DiscoverRunner(buffer=True, parallel=2)
 def test_init_debug_mode(self):
     runner = DiscoverRunner()
     self.assertFalse(runner.debug_mode)
Ejemplo n.º 51
0
 def setUp(self):
     self.runner_instance = DiscoverRunner(verbosity=0)
    def test_dotted_test_module(self):
        count = DiscoverRunner().build_suite(
            ["test_discovery_sample.tests_sample"],
        ).countTestCases()

        self.assertEqual(count, 6)
Ejemplo n.º 53
0
#!/usr/bin/env python

import os
import sys

import django

if __name__ == '__main__':
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tests.settings')
    django.setup()
    from django.test.runner import DiscoverRunner
    test_runner = DiscoverRunner(verbosity=2)
    failures = test_runner.run_tests(['tests.base'])
    if failures:
        sys.exit(failures)
Ejemplo n.º 54
0
        'django.contrib.admin',

        'tabbed_admin',
        'tabbed_admin.tests'
    )
)


try:
    # Django < 1.8
    from django.test.simple import DjangoTestSuiteRunner
    test_runner = DjangoTestSuiteRunner(verbosity=1)
except ImportError:
    # Django >= 1.8
    from django.test.runner import DiscoverRunner
    test_runner = DiscoverRunner(verbosity=1)

try:
    # Django < 1.7
    from django.core.management import setup_environ
    setup_environ(settings)
    failures = test_runner.run_tests(['tabbed_admin'])
except:
    # Django >= 1.7
    import django
    django.setup()

failures = test_runner.run_tests(['tabbed_admin'])
if failures:
    sys.exit(failures)
Ejemplo n.º 55
0
 def test_faulthandler_enabled_fileno(self, mocked_enable):
     # sys.stderr that is not an actual file.
     with mock.patch('faulthandler.is_enabled',
                     return_value=False), captured_stderr():
         DiscoverRunner(enable_faulthandler=True)
         mocked_enable.assert_called()
Ejemplo n.º 56
0
    def test_pattern(self):
        count = DiscoverRunner(pattern="*_tests.py", ).build_suite(
            ['test_runner_apps.sample']).countTestCases()

        self.assertEqual(count, 1)
Ejemplo n.º 57
0
    def test_file_path(self):
        with change_cwd(".."):
            count = DiscoverRunner().build_suite(
                ['test_runner_apps/sample/'], ).countTestCases()

        self.assertEqual(count, 5)
Ejemplo n.º 58
0
    def test_dotted_test_class_django_testcase(self):
        count = DiscoverRunner().build_suite(
            ['test_runner_apps.sample.tests_sample.TestDjangoTestCase'
             ], ).countTestCases()

        self.assertEqual(count, 1)
    def test_dotted_test_method_django_testcase(self):
        count = DiscoverRunner().build_suite(
            ["test_discovery_sample.tests_sample.TestDjangoTestCase.test_sample"],
        ).countTestCases()

        self.assertEqual(count, 1)
Ejemplo n.º 60
0
def before_all(context):
    django.setup()
    context.test_runner = DiscoverRunner()
    context.test_runner.setup_test_environment()
    context.browser = Browser('chrome', headless=True)