| 1 | import os
|
|---|
| 2 | from django.conf import settings
|
|---|
| 3 | from django.db import connections
|
|---|
| 4 | from django.test import SimpleTestCase
|
|---|
| 5 | if not settings.configured:
|
|---|
| 6 | settings.configure(
|
|---|
| 7 | DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'},
|
|---|
| 8 | 'other': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}},
|
|---|
| 9 | INSTALLED_APPS=[],
|
|---|
| 10 | )
|
|---|
| 11 | class BuggyTest(SimpleTestCase):
|
|---|
| 12 | databases = {'default'}
|
|---|
| 13 | def reproduce():
|
|---|
| 14 | BuggyTest.setUpClass()
|
|---|
| 15 | print("First cleanup...")
|
|---|
| 16 | BuggyTest._remove_databases_failures()
|
|---|
| 17 | print("Second cleanup (should crash without fix)...")
|
|---|
| 18 | BuggyTest._remove_databases_failures()
|
|---|
| 19 | if __name__ == "__main__":
|
|---|
| 20 | reproduce()
|
|---|