0
0
mirror of https://github.com/django/django.git synced 2024-11-29 14:46:18 +01:00
Commit Graph

150 Commits

Author SHA1 Message Date
Mariusz Felisiak
8b4983cfd4
Fixed typo in tests/test_runner/test_discover_runner.py. 2021-06-10 13:25:05 +02:00
Ceesjan Luiten
cb6c19749d Refs #27734 -- Prevented creation of more parallel workers than TestCases.
The parallel test runner uses multiple workers to distribute the
workload. These workers are assigned a worker ID using a globally
incremented variable, which determines what test database to connect
to. When the worker ID surpasses the test database IDs Django will
crash.

This reduce likelihood of crashing parallel tests because
ParallelTestSuite will no longer create more workers than TestCases.

It won't eliminate the problem completely though because there are
other circumstances in which new workers can be created which can then
be assigned an "illegal" worker ID.
2021-06-10 07:32:15 +02:00
Mariusz Felisiak
62e8f369c3
Fixed #32808 -- Prevented DiscoverRunner.build_suite() from mutating test loader patterns.
Thanks Chris Jerdonek for the report and reviews.
2021-06-03 08:59:37 +02:00
Chris Jerdonek
1b4d1675b2
Refs #32641 -- Made DiscoverRunner's "Found X tests" message work for finding one test.
This also removes passing level to log() as logging.INFO is the default.
2021-06-02 12:53:09 +02:00
Daniyal
a0410ffe8f Refs #32552 -- Added DiscoverRunner.log() to allow customization.
Thanks Carlton Gibson, Chris Jerdonek, and David Smith for reviews.
2021-06-01 13:31:44 +02:00
girishsontakke
a815a6a315 Fixed #32641 -- Made DiscoverRunner print the number of found tests.
Thanks Chris Jerdonek for reviews.
2021-04-15 11:42:46 +02:00
Chris Jerdonek
a89e975caf Fixed #32532 -- Made DiscoverRunner raise RuntimeError when a test label is a file path. 2021-04-02 12:54:08 +02:00
Chris Jerdonek
038940cf55 Fixed #29127 -- Prevented DiscoverRunner from hiding tagged test with syntax errors.
This mades _FailedTest objects always match tags in DiscoverRunner.
2021-03-30 10:26:20 +02:00
Chris Jerdonek
dcb06c2c68 Fixed #32591 -- Made DiscoverRunner order _FailedTest objects first.
Failures detected when loading tests are ordered before all of the
above for quicker feedback. This includes things like test modules that
couldn't be found or that couldn't be loaded due to syntax errors.
2021-03-26 12:18:27 +01:00
Mariusz Felisiak
5b618f239c
Fixed RemoteTestResultTest tests without tblib.
Follow up to e3bca22e7e.
2021-03-25 10:33:54 +01:00
Adam Johnson
f6713cda89 Fixed #31370 -- Added support for parallel tests with --buffer. 2021-03-18 15:30:47 +01:00
Adam Johnson
e3bca22e7e Refs #31370 -- Made RemoteTestResult subclass unittest.TestResult. 2021-03-18 15:30:47 +01:00
Adam Johnson
92975bcd5f Refs #31370 -- Added test for pickling RemoteTestResult. 2021-03-18 15:30:47 +01:00
Chris Jerdonek
d828beb68f Fixed #32529 -- Delayed creating a test suite in build_suite(). 2021-03-11 10:02:06 +01:00
Chris Jerdonek
d8a4bcffdb Refs #32489 -- Doc'd and tested iter_test_cases() support for an iterable of tests. 2021-03-11 09:23:33 +01:00
Chris Jerdonek
77e0a35a10 Fixed #32516 -- Fixed reorder_suite() with duplicates and reverse=True. 2021-03-09 13:30:51 +01:00
Chris Jerdonek
22c9af0eae Fixed #32489 -- Added iter_test_cases() to iterate over a TestSuite.
This also makes partition_suite_by_type(), partition_suite_by_case(),
filter_tests_by_tags(), and DiscoverRunner._get_databases() to use
iter_test_cases().
2021-03-05 13:04:07 +01:00
Simon Charette
3089018e95 Fixed #32446 -- Deprecated SERIALIZE test database setting.
Whether or not the state of a test database should be serialized can be
inferred from the set of databases allowed to be access from discovered
TestCase/TransactionTestCase enabling the serialized_rollback feature
which makes this setting unnecessary.

This should make a significant test suite bootstraping time difference
on large projects that didn't explicitly disable test database
serialization.
2021-02-24 20:31:11 +01:00
Harm Geerts
06e5f7ae16 Fixed #29052 -- Made test database creation preserve alias order and prefer the "default" database.
This fixes flushing test databases when two aliases point to the same
database.

Use a list() to store the test database aliases so the order remains
stable by following the order of the connections. Also, always use the
"default" database alias as the first alias to accommodate `migrate`.

Previously `migrate` could be executed on a secondary alias which
caused truncating the "default" database.
2021-02-16 10:25:34 +01:00
Mariusz Felisiak
ec0ff40631 Fixed #32355 -- Dropped support for Python 3.6 and 3.7 2021-02-10 10:20:54 +01:00
Mariusz Felisiak
00a1d42bf0
Fixed isolation of test_runner.EmptyDefaultDatabaseTest.
This fixes test_runner.test_debug_sql.TestDebugSQL.
test_setupclass_exception when run in reverse.
2020-12-10 18:48:07 +01:00
Adam Johnson
b9fd09d21b Fixed #32227 -- Prevented crash when setUpTestData() errors with --debug-sql.
Thanks Mariusz Felisiak for the report.
2020-11-28 12:22:59 +01:00
Ahmad A. Hussein
61a0ba43cf Refs #31811 -- Added optional timing outputs to the test runner. 2020-08-13 17:17:15 +02:00
ovkulkarni
b7a438c7e2 Fixed #31509 -- Made DiscoverRunner enable faulthandler by default. 2020-07-10 18:55:50 +02:00
Matthijs Kooijman
2a2ea4ee18 Refs #31117 -- Made various tests properly handle unexpected databases aliases.
- Used selected "databases" instead of django.db.connections.
- Made routers in tests.migrations skip migrations on unexpected
  databases.
- Added DiscoverRunnerGetDatabasesTests.assertSkippedDatabases() hook
  which properly asserts messages about skipped databases.
2020-01-20 14:39:02 +01:00
Baptiste Mispelon
9e565386d3 Fixed #27430 -- Added -b/--buffer option to DiscoverRunner. 2019-12-09 13:47:12 +01:00
Mariusz Felisiak
f464526388
Refs #30676 -- Added test for invalid --pdb and --parallel usage in DiscoverRunner. 2019-12-09 11:12:06 +01:00
Mariusz Felisiak
25903e41fb Refs #29926 -- Bumped minimum tblib version to 1.5.0 in test requirements. 2019-10-23 15:26:04 +02:00
Mariusz Felisiak
2847d2c760
Refs #29926 -- Skipped RemoteTestResultTest.test_add_failing_subtests() on Python 3.8+ and tblib <= 1.4.0. 2019-10-22 15:34:19 +02:00
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