migration_status: Move connection.close_all() to test_fixtures.py.

The `get_migration_status` command calls `connections.close_all()` when
its done and it was previously only called when we need to rebuild the
dev or test database and when running the `get_migration_status`
command.

This commit moves the `connections.close_all()` call out of the function
and into `test_fixtures.py` directly, making sure it will only be called
when we are rebuilding the dev/test database. This is a prep work to
refactor the check migration function of import/export later on which
plans to use `get_migration_status`.
This commit is contained in:
PieterCK
2025-01-13 14:53:35 +07:00
committed by Tim Abbott
parent dfae02a273
commit 5f2286353f
2 changed files with 2 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ from typing import Any
def get_migration_status(**options: Any) -> str:
from django.apps import apps
from django.core.management import call_command
from django.db import DEFAULT_DB_ALIAS, connections
from django.db import DEFAULT_DB_ALIAS
from django.utils.module_loading import module_has_submodule
verbosity = options.get("verbosity", 1)
@@ -35,7 +35,6 @@ def get_migration_status(**options: Any) -> str:
traceback=options.get("traceback", True),
verbosity=verbosity,
)
connections.close_all()
out.seek(0)
output = out.read()
return re.sub(r"\x1b\[(1|0)m", "", output)