From 2dc55b62d995ff2c5077a6094c74e4b0959ebf9b Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Tue, 11 Jun 2024 16:45:56 -0400 Subject: [PATCH 1/2] Remove uses of nose.tools.istest --- corehq/apps/users/tests/test_authorization.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/corehq/apps/users/tests/test_authorization.py b/corehq/apps/users/tests/test_authorization.py index 1a3e1790dc63..958e21794e96 100644 --- a/corehq/apps/users/tests/test_authorization.py +++ b/corehq/apps/users/tests/test_authorization.py @@ -2,7 +2,7 @@ from decorator import contextmanager from django.test import TestCase -from nose.tools import nottest, istest +from django.utils.functional import classproperty from corehq.apps.domain.models import Domain from corehq.apps.domain.shortcuts import create_domain @@ -11,9 +11,12 @@ from corehq.apps.users.role_utils import UserRolePresets -@nottest class BaseAuthorizationTest(TestCase): + @classproperty + def __test__(cls): + return cls is not BaseAuthorizationTest + @classmethod def setUpTestData(cls): cls.domain = 'my-domain' @@ -141,7 +144,6 @@ def test_has_permission__default_yes__null_domain(self): self.assertFalse(self.user.has_permission(None, 'report_an_issue')) -@istest class TestMobileUserAuthorizationFunctions(BaseAuthorizationTest): @classmethod def _create_user(cls, domain): @@ -164,7 +166,6 @@ def test_is_domain_admin__admin_role(self): self.assertFalse(self.user.is_domain_admin(self.domain)) -@istest class TestWebUserAuthorizationFunctions(BaseAuthorizationTest): @classmethod def _create_user(cls, domain): @@ -177,7 +178,6 @@ def _create_user(cls, domain): ) -@istest class TestSuperUserAuthorizationFunctions(BaseAuthorizationTest): @classmethod def _create_user(cls, domain): From 6fbf1538473bf51c25147b961bc72f8caf62b8cb Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Fri, 14 Jun 2024 16:17:56 -0400 Subject: [PATCH 2/2] Fix create_kafka_topics: do not use nose.tools ...when settings.UNIT_TESTING is True --- corehq/tests/util/warnings.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/corehq/tests/util/warnings.py b/corehq/tests/util/warnings.py index ab4350b5a3db..ef9334996b6f 100644 --- a/corehq/tests/util/warnings.py +++ b/corehq/tests/util/warnings.py @@ -3,8 +3,7 @@ from functools import wraps from unittest import TestCase -from nose.tools import nottest - +from corehq.tests.tools import nottest from corehq.util.test_utils import unit_testing_only