Beispiel #1
0
    def test_check_compatibility(self):
        with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'):
            result = base.check_compatibility()
            self.assertEqual(len(result), 1)
            self.assertTrue("Django 1.6 introduced a new default test runner" in result[0])

        with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'):
            self.assertEqual(len(base.check_compatibility()), 0)
Beispiel #2
0
    def test_check_compatibility(self):
        with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'):
            result = base.check_compatibility()
            self.assertEqual(len(result), 1)
            self.assertTrue("You have not explicitly set 'TEST_RUNNER'" in result[0])

        with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'):
            self.assertEqual(len(base.check_compatibility()), 0)
Beispiel #3
0
    def test_check_compatibility(self):
        with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'):
            result = base.check_compatibility()
            self.assertEqual(len(result), 1)
            self.assertTrue(
                "You have not explicitly set 'TEST_RUNNER'" in result[0])

        with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'):
            self.assertEqual(len(base.check_compatibility()), 0)
Beispiel #4
0
    def test_check_compatibility(self):
        with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'):
            result = base.check_compatibility()
            self.assertEqual(len(result), 1)
            self.assertTrue(
                "Django 1.6 introduced a new default test runner" in result[0])

        with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'):
            self.assertEqual(len(base.check_compatibility()), 0)
Beispiel #5
0
    def test_check_compatibility_warning(self):
        # First, we're patching over the ``COMPAT_CHECKS`` with a stub which
        # will trigger the warning.
        base.COMPAT_CHECKS = [
            StubCheckModule(),
        ]

        # Next, we unfortunately have to patch out ``warnings``.
        old_warnings = base.warnings
        base.warnings = FakeWarnings()

        self.assertEqual(len(base.warnings._warnings), 0)

        with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'):
            self.assertEqual(len(base.check_compatibility()), 0)

        self.assertEqual(len(base.warnings._warnings), 1)
        self.assertTrue("The 'StubCheckModule' module lacks a 'run_checks'" in base.warnings._warnings[0])

        # Restore the ``warnings``.
        base.warnings = old_warnings
Beispiel #6
0
    def test_check_compatibility_warning(self):
        # First, we're patching over the ``COMPAT_CHECKS`` with a stub which
        # will trigger the warning.
        base.COMPAT_CHECKS = [
            StubCheckModule(),
        ]

        # Next, we unfortunately have to patch out ``warnings``.
        old_warnings = base.warnings
        base.warnings = FakeWarnings()

        self.assertEqual(len(base.warnings._warnings), 0)

        with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'):
            self.assertEqual(len(base.check_compatibility()), 0)

        self.assertEqual(len(base.warnings._warnings), 1)
        self.assertTrue("The 'StubCheckModule' module lacks a 'run_checks'" in
                        base.warnings._warnings[0])

        # Restore the ``warnings``.
        base.warnings = old_warnings
Beispiel #7
0
 def handle_noargs(self, **options):
     for message in check_compatibility():
         warnings.warn(message)