David Smith
74b5074174
Fixed #34210 -- Added unittest's durations option to the test runner.
2023-08-31 07:14:58 +02:00
Mariusz Felisiak
dd45d5223b
Fixed ResourceWarning from unclosed SQLite connection on Python 3.13+.
...
- backends.sqlite.tests.ThreadSharing.test_database_sharing_in_threads
- backends.tests.ThreadTests.test_default_connection_thread_local:
on SQLite, close() doesn't explicitly close in-memory connections.
- servers.tests.LiveServerInMemoryDatabaseLockTest
- test_runner.tests.SQLiteInMemoryTestDbs.test_transaction_support
Check out https://github.com/python/cpython/pull/108015 .
2023-08-23 09:09:23 +02:00
konsti
48a1929ca0
Removed unnecessary trailing commas in tests.
2023-08-22 12:42:57 +02:00
David Smith
097e3a70c1
Refs #33476 -- Applied Black's 2023 stable style.
...
Black 23.1.0 is released which, as the first release of the year,
introduces the 2023 stable style. This incorporates most of last year's
preview style.
https://github.com/psf/black/releases/tag/23.1.0
2023-02-01 11:04:38 +01:00
Mariusz Felisiak
43b01300b7
Refs #32655 -- Removed extra_tests argument for DiscoverRunner.build_suite()/run_tests().
...
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak
6c0539ed7c
Refs #32446 -- Removed SERIALIZE test database setting per deprecation timeline.
2023-01-17 11:49:15 +01:00
Nick Pope
2bc47d7fe9
Avoided assignment followed by immediate return.
...
Identified using the following command:
$ pcre2grep --line-number --multiline --recursive \
"(?s)(\n +)(\w+) = [^\n]+\1return \2;?$" \
django docs extras js_tests scripts tests
2022-10-31 12:31:13 +01:00
Giebisch
3283120cca
Fixed #34111 -- Made test runner with --debug-sql format SQL queries.
2022-10-24 08:11:30 +02:00
Adam Johnson
0f5b11eca0
Refs #34010 -- Made --debug-mode work for parallel tests using spawn.
...
Bug in 3b3f38b3b0
.
Thanks Kevin Renskers for the report.
2022-09-28 19:39:25 +02:00
Mariusz Felisiak
41c4cb253c
Fixed #33719 -- Fixed test command crash when running in parallel.
...
Thanks Pēteris Caune for the report.
Regression in 3b3f38b3b0
.
2022-05-19 10:20:51 +02:00
Mariusz Felisiak
2ee4caf56b
Refs #33173 -- Fixed test_runner/test_utils tests on Python 3.11+.
...
Python 3.11 uses fully qualified test name in unittest output. See
755be9b150
2022-04-07 07:02:21 +02:00
David Smith
ba298a32b3
Refs #31169 -- Prevented infinite loop in parallel tests with custom test runner when using spawn.
...
Regression in 3b3f38b3b0
.
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-03-17 10:20:13 +01:00
David Smith
3b3f38b3b0
Fixed #31169 -- Adapted the parallel test runner to use spawn.
...
Co-authored-by: Valz <ahmadahussein0@gmail.com>
Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2022-03-15 16:23:55 +01:00
Mariusz Felisiak
7119f40c98
Refs #33476 -- Refactored code to strictly match 88 characters line length.
2022-02-07 20:37:05 +01:00
django-bot
9c19aff7c7
Refs #33476 -- Reformatted code with Black.
2022-02-07 20:37:05 +01:00
Mariusz Felisiak
c5cd878382
Refs #33476 -- Refactored problematic code before reformatting by Black.
...
In these cases Black produces unexpected results, e.g.
def make_random_password(
self,
length=10,
allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789',
):
or
cursor.execute("""
SELECT ...
""",
[table name],
)
2022-02-03 11:20:46 +01:00
Baptiste Mispelon
91acfc3514
Fixed #33264 -- Made test runner return non-zero error code for unexpected successes.
2021-11-08 20:19:21 +01:00
Chris Jerdonek
b263f4b69d
Fixed #32552 -- Added logger argument to DiscoverRunner.
2021-08-24 09:23:01 +02:00
Mariusz Felisiak
36714be874
Refs #31621 -- Fixed handling --parallel option in test management command and runtests.py.
...
Regression in ae89daf46f
.
Thanks Tim Graham for the report.
2021-08-19 09:18:32 +02:00
Mariusz Felisiak
c2a5735d86
Refs #31621 -- Added more tests for test --parallel option.
2021-08-19 09:18:32 +02:00
Mariusz Felisiak
ab16507f19
Fixed #32988 -- Prevented creation of more test databases than TestCases.
...
DiscoverRunner.parallel is used in setup_databases() and
teardown_databases() to control the number of test databases.
Regression in cb6c19749d
.
2021-08-05 05:55:35 +02:00
Adam Johnson
ae89daf46f
Fixed #31621 -- Added support for '--parallel auto' to test management command.
2021-08-03 09:57:04 +02:00
Adam Johnson
7e38a8d66f
Refs #31621 -- Added more tests for test --parallel option.
2021-08-03 09:57:04 +02:00
Jacob Walls
56f9579105
Fixed #32655 -- Deprecated extra_tests argument for DiscoverRunner.build_suite()/run_tests().
2021-07-16 20:46:41 +02:00
Chris Jerdonek
5848b3a1d7
Fixed #32914 -- Prevented test --shuffle from skipping test methods.
...
"test --shuffle" skipped test methods when test classes were mixed.
This changes runner.py's reorder_tests() to group by TestCase class.
Regression in 90ba716bf0
.
2021-07-12 06:36:12 +02:00
Chris Jerdonek
90ba716bf0
Fixed #24522 -- Added a --shuffle option to DiscoverRunner.
2021-07-08 07:29:04 +02:00
Mads Jensen
c51bf80d56
Used more specific unittest assertions in tests.
2021-07-07 10:51:38 +02:00
Chris Jerdonek
8bca838f4a
Refs #32655 -- Improved error if iter_test_cases() is passed a string.
2021-06-29 20:41:40 +02:00
Chris Jerdonek
de4f620183
Fixed #32609 -- Updated runtests.py to support directory path test labels.
...
For example, with this change, the following now works from the tests
directory:
$ ./runtests.py view_tests/tests/
2021-06-10 20:19:30 +02:00
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