diff options
| author | Preston Holmes <preston@ptone.com> | 2013-01-02 16:00:39 -0800 |
|---|---|---|
| committer | Preston Holmes <preston@ptone.com> | 2013-01-09 08:19:56 -0800 |
| commit | af8e858c1596623ffcccedc57433a009455bc314 (patch) | |
| tree | 401d591ee518b252a9d62757c4ad0beef38542b1 /tests/regressiontests/test_runner | |
| parent | 7c39e041b1e107f437f61e97a11ce9e011d9ad2b (diff) | |
[1.5.x] Fixed #19546 - ensure that deprecation warnings are shown during tests
refs #18985
Diffstat (limited to 'tests/regressiontests/test_runner')
4 files changed, 31 insertions, 0 deletions
diff --git a/tests/regressiontests/test_runner/deprecation_app/__init__.py b/tests/regressiontests/test_runner/deprecation_app/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/regressiontests/test_runner/deprecation_app/__init__.py diff --git a/tests/regressiontests/test_runner/deprecation_app/models.py b/tests/regressiontests/test_runner/deprecation_app/models.py new file mode 100644 index 0000000000..71a8362390 --- /dev/null +++ b/tests/regressiontests/test_runner/deprecation_app/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/tests/regressiontests/test_runner/deprecation_app/tests.py b/tests/regressiontests/test_runner/deprecation_app/tests.py new file mode 100644 index 0000000000..e676c3e3d5 --- /dev/null +++ b/tests/regressiontests/test_runner/deprecation_app/tests.py @@ -0,0 +1,9 @@ +import warnings + +from django.test import TestCase + +class DummyTest(TestCase): + def test_warn(self): + warnings.warn("warning from test", DeprecationWarning) + + diff --git a/tests/regressiontests/test_runner/tests.py b/tests/regressiontests/test_runner/tests.py index 5ef4d5537d..685e88d6ee 100644 --- a/tests/regressiontests/test_runner/tests.py +++ b/tests/regressiontests/test_runner/tests.py @@ -279,6 +279,25 @@ class DummyBackendTest(unittest.TestCase): db.connections = old_db_connections +class DeprecationDisplayTest(AdminScriptTestCase): + # tests for 19546 + def setUp(self): + settings = {'INSTALLED_APPS': '("regressiontests.test_runner.deprecation_app",)' } + self.write_settings('settings.py', sdict=settings) + + def tearDown(self): + self.remove_settings('settings.py') + + def test_runner_deprecation_verbosity_default(self): + args = ['test', '--settings=regressiontests.settings'] + out, err = self.run_django_admin(args) + self.assertTrue("DeprecationWarning: warning from test" in err) + + def test_runner_deprecation_verbosity_zero(self): + args = ['test', '--settings=regressiontests.settings', '--verbosity=0'] + out, err = self.run_django_admin(args) + self.assertFalse("DeprecationWarning: warning from test" in err) + class AutoIncrementResetTest(TransactionTestCase): """ Here we test creating the same model two times in different test methods, |
