mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
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.
This commit is contained in:
parent
26be703fe6
commit
2a2ea4ee18
9 changed files with 46 additions and 34 deletions
|
@ -687,11 +687,15 @@ class ThreadTests(TransactionTestCase):
|
|||
conn.inc_thread_sharing()
|
||||
connections_dict[id(conn)] = conn
|
||||
try:
|
||||
for x in range(2):
|
||||
num_new_threads = 2
|
||||
for x in range(num_new_threads):
|
||||
t = threading.Thread(target=runner)
|
||||
t.start()
|
||||
t.join()
|
||||
self.assertEqual(len(connections_dict), 6)
|
||||
self.assertEqual(
|
||||
len(connections_dict),
|
||||
len(connections.all()) * (num_new_threads + 1),
|
||||
)
|
||||
finally:
|
||||
# Finish by closing the connections opened by the other threads
|
||||
# (the connection opened in the main thread will automatically be
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue