From 2563a4de33a8ffa734fba7aa86ecd6de100ace3b Mon Sep 17 00:00:00 2001 From: gindibay Date: Sat, 23 Sep 2023 03:42:22 +0300 Subject: [PATCH] * Updates requirements with pip * Fixes black issues --- django_multitenant/tests/settings.py | 1 - django_multitenant/tests/test_utils.py | 13 ++++++++----- requirements/test-requirements.txt | 6 ++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/django_multitenant/tests/settings.py b/django_multitenant/tests/settings.py index ec81c39..5e90198 100644 --- a/django_multitenant/tests/settings.py +++ b/django_multitenant/tests/settings.py @@ -80,4 +80,3 @@ USE_TZ = True TENANT_USE_ASGIREF = False - diff --git a/django_multitenant/tests/test_utils.py b/django_multitenant/tests/test_utils.py index 6ace95f..6b1b9e2 100644 --- a/django_multitenant/tests/test_utils.py +++ b/django_multitenant/tests/test_utils.py @@ -38,16 +38,18 @@ def test_tenant_persists_from_thread_to_async_task(self): set_current_tenant(account) with self.settings(TENANT_USE_ASGIREF=True): - importlib.reload(sys.modules['django_multitenant.utils']) + importlib.reload(sys.modules["django_multitenant.utils"]) from django_multitenant.utils import get_current_tenant + # Check the tenant within an async task when asgiref enabled tenant = async_to_sync(self.async_get_current_tenant)() self.assertEqual(get_current_tenant(), tenant) unset_current_tenant() with self.settings(TENANT_USE_ASGIREF=False): - importlib.reload(sys.modules['django_multitenant.utils']) + importlib.reload(sys.modules["django_multitenant.utils"]) from django_multitenant.utils import get_current_tenant + # Check the tenant within an async task when asgiref is disabled tenant = async_to_sync(self.async_get_current_tenant)() self.assertIsNone(get_current_tenant()) @@ -58,22 +60,23 @@ def test_tenant_persists_from_async_task_to_thread(self): account = projects[0].account with self.settings(TENANT_USE_ASGIREF=True): - importlib.reload(sys.modules['django_multitenant.utils']) + importlib.reload(sys.modules["django_multitenant.utils"]) from django_multitenant.utils import get_current_tenant + # Set the tenant in task async_to_sync(self.async_set_current_tenant)(account) self.assertEqual(get_current_tenant(), account) unset_current_tenant() with self.settings(TENANT_USE_ASGIREF=False): - importlib.reload(sys.modules['django_multitenant.utils']) + importlib.reload(sys.modules["django_multitenant.utils"]) from django_multitenant.utils import get_current_tenant + # Set the tenant in task async_to_sync(self.async_set_current_tenant)(account) self.assertIsNone(get_current_tenant()) unset_current_tenant() - def test_get_tenant_column(self): from .models import Project diff --git a/requirements/test-requirements.txt b/requirements/test-requirements.txt index f59da2a..66cc14b 100644 --- a/requirements/test-requirements.txt +++ b/requirements/test-requirements.txt @@ -35,3 +35,9 @@ pytest-cov==4.1.0 # via -r requirements/test.in pytest-django==4.5.2 # via -r requirements/test.in +tomli==2.0.1 + # via + # coverage + # pytest +typing-extensions==4.8.0 + # via asgiref