Commit Graph

121 Commits

Author SHA1 Message Date
Min ho Kim 65e86948b8 Corrected several typos in string literals and test names. 2019-08-07 11:23:14 +02:00
François Freitag 568eed9e79 Fixed #30245 -- Added -k option to DiscoverRunner. 2019-04-30 16:20:51 +02:00
Jon Dufresne 487d904bf2 Simplified temporary directory handling in AdminScriptTestCase.
Use tempfile.TemporaryDirectory() in AdminScriptTestCase.setUp()
to create and destroy a temporary directory for each test. It removes
the need for individual tests to delete files.

For test classes that don't use the temporary directory, inherit from
SimpleTestCase.
2019-02-05 12:11:54 -05:00
Simon Charette 41e73de39d Fixed #28478 -- Make DiscoverRunner skip creating unused test databases.
SimpleTestCase.databases makes it possible to determine the set of
databases required to run the discovered tests.
2019-01-10 19:11:21 -05:00
Simon Charette 8c775391b7 Refs #28478 -- Deprecated TestCase's allow_database_queries and multi_db in favor of databases. 2019-01-10 19:11:21 -05:00
Simon Charette f6d8b0c47e Refs #26840 -- Corrected SQLite connection mocking in a setup_databases() test.
The test was expecting connections used by DiscoverRunner.setup_databases()
to be the ones defined in django.test.runner but this doesn't hold true
since this method was made a proxy of django.test.utils.setup_databases.

This broke the TransactionTestCase.serialized_rollback feature in the test
suite because calls to create_db_test() cleared the test data persisted on
connections objects.

Added an assertions to prevent this from happening again.
2018-12-24 15:32:27 -05:00
Nick Pope e626a3f993 Renamed Sqlite and Sqlite3 references to SQLite. 2018-12-22 18:52:54 -05:00
Simon Charette 315357ad25 Fixed #30023 -- Prevented SQLite schema alterations while foreign key checks are enabled.
Prior to this change foreign key constraint references could be left pointing
at tables dropped during operations simulating unsupported table alterations
because of an unexpected failure to disable foreign key constraint checks.

SQLite3 does not allow disabling such checks while in a transaction so they
must be disabled beforehand.

Thanks ezaquarii for the report and Carlton and Tim for the review.
2018-12-15 18:51:59 -05:00
Tim Graham 4c7c608a1d Reverted "Fixed #25251 -- Made data migrations available in TransactionTestCase when using --keepdb."
This reverts commits b3b1d3d45f and
9fa0d3786f due to reverse build failures
for which a solution isn't forthcoming.
2018-12-05 15:30:23 -05:00
romgar 9fa0d3786f Refs #25251 -- Filtered out skipped tests when processing the test suite to set _next_serialized_rollback. 2018-11-29 11:20:27 -05:00
Tim Graham 193c109327 Switched TestCase to SimpleTestCase where possible in Django's tests. 2018-11-27 08:58:44 -05:00
romgar b3b1d3d45f Fixed #25251 -- Made data migrations available in TransactionTestCase when using --keepdb.
Data loaded in migrations were restored at the beginning of each
TransactionTestCase and all the tables are truncated at the end of
these test cases. If there was a TransactionTestCase at the end of
the test suite, the migrated data weren't restored in the database
(especially unexpected when using --keepdb). Now data is restored
at the end of each TransactionTestCase.
2018-11-06 16:57:50 -05:00
Jayden Kneller 916aecd29d Fixed #29866 -- Made DiscoverRunner do tests tear down if running checks or tests raises an exception. 2018-10-30 12:01:48 -04:00
Matthijs Kooijman 08f360355a Fixed #29704 -- Fixed manage.py test --testrunner if it isn't followed by an equals sign. 2018-08-23 10:12:03 -04:00
Matthijs Kooijman 69071e7f51 Added manage.py test --testrunner tests. 2018-08-23 10:12:03 -04:00
Oliver Sauder a07a49ee32 Fixed #29559 -- Fixed TransactionTestCase.reset_sequences for auto-created m2m through models. 2018-07-11 17:20:29 -04:00
Tim Graham 4d98b9d729 Refs #9804 -- Fixed test for sequence reset of M2M with inherited through model. 2018-07-11 16:45:29 -04:00
Claude Paroz eac9ab7ebb Removed parser.add_arguments() arguments that match the defaults. 2018-07-02 17:54:57 -04:00
Sanyam Khurana 5a669ae2f4 Fixed #29106 -- Made DiscoverRunner display selected test tags. 2018-02-13 12:56:31 -05:00
Will Ayd 09530e61a0 Fixed #28869 -- Made tagged test classes and methods inherit tags from parents. 2018-01-08 20:57:33 -05:00
Tim Graham 8e1a7dab4b Reorganized test_runner test apps. 2018-01-04 15:41:33 -05:00
Tim Graham 9d1d3b2d2f Refs #28814 -- Fixed test_runner failure on Python 3.7.
Due to https://bugs.python.org/issue30399.
2017-11-17 16:13:23 -05:00
Tim Graham cfff2af02b Fixed #27857 -- Dropped support for Python 3.4. 2017-09-25 17:11:03 -04:00
Sergey Fedoseev 6de2930078 Fixed #28360 -- Fixed test runner crash with --debug-sql on fail/error in subTest. 2017-07-05 16:56:24 -04:00
Tim Graham 2dc3280254 Fixed #28160 -- Prevented hiding GDAL exceptions when it's not installed. 2017-05-04 20:45:18 -04:00
Tim Graham ab83d4d8fe Added multi_db=True to test cases that access the 'other' db connection.
Fixed a failure in the context processors tests when running in
reverse on MySQL due to an extra query after refs #27683.
2017-02-10 08:19:32 -05:00
Tim Graham 29f607927f Fixed spelling of "nonexistent". 2017-02-03 08:01:45 -05:00
chillaranand d6eaf7c018 Refs #23919 -- Replaced super(ClassName, self) with super(). 2017-01-25 12:23:46 -05:00
Tim Graham 7aba69145d Refs #23919 -- Removed django.test.mock Python 2 compatibility shim. 2017-01-20 08:17:20 -05:00
Simon Charette cecc079168 Refs #23919 -- Stopped inheriting from object to define new style classes. 2017-01-19 08:39:46 +01:00
Claude Paroz 2b281cc35e Refs #23919 -- Removed most of remaining six usage
Thanks Tim Graham for the review.
2017-01-18 21:33:28 +01:00
Claude Paroz c716fe8782 Refs #23919 -- Removed six.PY2/PY3 usage
Thanks Tim Graham for the review.
2017-01-18 16:21:28 +01:00
Claude Paroz d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
Adam Chainz 6d947e8c32 Refs #25415 -- Fixed/silenced check errors in Django's test suite. 2016-12-28 15:16:10 -05:00
Ramin Farajpour Cami 967be82443 Fixed E305 flake8 warnings. 2016-11-14 12:30:46 -05:00
za 321e94fa41 Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings. 2016-11-10 21:30:21 -05:00
Adam Wróbel 52188a5ca6 Fixed #27301 -- Prevented exceptions that fail unpickling from crashing the parallel test runner. 2016-10-06 15:54:38 -04:00
Chris Jerdonek 7ca3b391b6 Fixed #27170 -- Added DatabaseWrapper class attributes to ease subclassing. 2016-09-08 16:33:36 -04:00
Chris Jerdonek 42dcceba61 Fixed #26942 -- Added support for subtests during parallel testing. 2016-08-26 14:24:27 -04:00
Andreas Pelme e76981b433 Fixed #26840 -- Added test.utils.setup/teardown_databases(). 2016-08-17 13:55:04 -04:00
Chris Jerdonek 5890b1613c Fixed #27008 -- Added --debug-mode option to DiscoverRunner. 2016-08-12 20:43:17 -04:00
Chris Jerdonek a3a5ef4d0e Fixed #27035 -- Eased changing settings.DEBUG for DiscoverRunner. 2016-08-09 13:40:29 -04:00
Chris Jerdonek ebed9ee8d5 Fixed #26981 -- Added DiscoverRunner.get_test_runner_kwargs(). 2016-08-04 14:45:44 -04:00
Tim Graham c9ae09addf Replaced use of TestCase.fail() with assertRaises().
Also removed try/except/fail antipattern that hides exceptions.
2016-06-28 11:21:26 -04:00
Tim Graham 92053acbb9 Fixed E128 flake8 warnings in tests/. 2016-04-08 10:12:33 -04:00
Jakub Paczkowski d4dc775620 Fixed #25735 -- Added support for test tags to DiscoverRunner.
Thanks Carl Meyer, Claude Paroz, and Simon Charette for review.
2016-02-17 09:44:18 -05:00
Hasan 3d0dcd7f5a Refs #26022 -- Used context manager version of assertRaises in tests. 2016-01-29 12:32:18 -05:00
Tim Graham 5b94b17fef Fixed #25999 -- Removed promotion of RemovedInNextVersionWarning to loud by default. 2016-01-14 09:05:43 -05:00
Josh Soref 93452a70e8 Fixed many spelling mistakes in code, comments, and docs. 2015-12-03 12:48:24 -05:00
Tim Graham 8d1a001ef6 Fixed #25466 -- Added backwards compatibility aliases for LoaderOrigin and StringOrigin.
Thanks Simon Charette for the DeprecationInstanceCheck class.
2015-09-29 18:31:11 -04:00