Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 4a46ace

Browse files
committed
Replace usage of TransactionTestCase
The `TransactionTestCase` is documented to be a bit slower than the normal one, and someone mentioned recently that this might be the reason why API tests are taking so long. So lets try changing that, and see whether the testsuite still works :-)
1 parent 9a787d5 commit 4a46ace

File tree

117 files changed

+244
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+244
-244
lines changed

codecov_auth/commands/owner/interactors/tests/test_cancel_trial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44
from asgiref.sync import async_to_sync
5-
from django.test import TransactionTestCase
5+
from django.test import TestCase
66
from freezegun import freeze_time
77
from shared.django_apps.codecov.commands.exceptions import ValidationError
88
from shared.django_apps.codecov_auth.tests.factories import PlanFactory, TierFactory
@@ -16,7 +16,7 @@
1616
from ..cancel_trial import CancelTrialInteractor
1717

1818

19-
class CancelTrialInteractorTest(TransactionTestCase):
19+
class CancelTrialInteractorTest(TestCase):
2020
def setUp(self):
2121
self.tier = TierFactory(tier_name=DEFAULT_FREE_PLAN)
2222
self.plan = PlanFactory(tier=self.tier)

codecov_auth/commands/owner/interactors/tests/test_create_api_token.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import pytest
2-
from django.test import TransactionTestCase
2+
from django.test import TestCase
33
from shared.django_apps.core.tests.factories import OwnerFactory
44

55
from codecov.commands.exceptions import Unauthenticated, ValidationError
66

77
from ..create_api_token import CreateApiTokenInteractor
88

99

10-
class CreateApiTokenInteractorTest(TransactionTestCase):
10+
class CreateApiTokenInteractorTest(TestCase):
1111
def setUp(self):
1212
self.owner = OwnerFactory(username="codecov-user")
1313

codecov_auth/commands/owner/interactors/tests/test_create_user_token.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
from django.test import TransactionTestCase
2+
from django.test import TestCase
33
from shared.django_apps.core.tests.factories import OwnerFactory
44

55
from codecov.commands.exceptions import Unauthenticated, ValidationError
@@ -8,7 +8,7 @@
88
from ..create_user_token import CreateUserTokenInteractor
99

1010

11-
class CreateUserTokenInteractorTest(TransactionTestCase):
11+
class CreateUserTokenInteractorTest(TestCase):
1212
def setUp(self):
1313
self.owner = OwnerFactory(username="codecov-user")
1414

codecov_auth/commands/owner/interactors/tests/test_delete_session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
from django.test import TransactionTestCase
2+
from django.test import TestCase
33
from shared.django_apps.codecov_auth.tests.factories import OwnerFactory, SessionFactory
44

55
from codecov.commands.exceptions import Unauthenticated
@@ -15,7 +15,7 @@ def get_session(id):
1515
return Session.objects.get(sessionid=id)
1616

1717

18-
class DeleteSessionInteractorTest(TransactionTestCase):
18+
class DeleteSessionInteractorTest(TestCase):
1919
def setUp(self):
2020
self.owner = OwnerFactory(username="codecov-user")
2121
self.django_session = DjangoSessionFactory()

codecov_auth/commands/owner/interactors/tests/test_get_is_current_user_an_admin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from unittest.mock import patch
22

33
from asgiref.sync import async_to_sync
4-
from django.test import TransactionTestCase, override_settings
4+
from django.test import TestCase, override_settings
55
from shared.django_apps.codecov_auth.tests.factories import (
66
GetAdminProviderAdapter,
77
OwnerFactory,
@@ -13,7 +13,7 @@
1313
)
1414

1515

16-
class GetIsCurrentUserAnAdminInteractorTest(TransactionTestCase):
16+
class GetIsCurrentUserAnAdminInteractorTest(TestCase):
1717
def setUp(self):
1818
self.owner_has_admins = OwnerFactory(ownerid=0, admins=[2])
1919
self.owner_has_no_admins = OwnerFactory(ownerid=1, admins=[])

codecov_auth/commands/owner/interactors/tests/test_get_org_upload_token.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
from django.test import TransactionTestCase
2+
from django.test import TestCase
33
from shared.django_apps.codecov_auth.tests.factories import (
44
OrganizationLevelTokenFactory,
55
OwnerFactory,
@@ -10,7 +10,7 @@
1010
from ..get_org_upload_token import GetOrgUploadToken
1111

1212

13-
class GetOrgUploadTokenInteractorTest(TransactionTestCase):
13+
class GetOrgUploadTokenInteractorTest(TestCase):
1414
def setUp(self):
1515
self.owner_with_no_upload_token = OwnerFactory()
1616
self.owner_with_upload_token = OwnerFactory(plan="users-enterprisem")

codecov_auth/commands/owner/interactors/tests/test_get_uploads_number_per_user.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from datetime import datetime, timedelta
22

3-
from django.test import TransactionTestCase
3+
from django.test import TestCase
44
from shared.django_apps.codecov_auth.tests.factories import PlanFactory, TierFactory
55
from shared.django_apps.core.tests.factories import (
66
CommitFactory,
@@ -16,7 +16,7 @@
1616
from ..get_uploads_number_per_user import GetUploadsNumberPerUserInteractor
1717

1818

19-
class GetUploadsNumberPerUserInteractorTest(TransactionTestCase):
19+
class GetUploadsNumberPerUserInteractorTest(TestCase):
2020
def setUp(self):
2121
self.tier = TierFactory(tier_name=TierName.BASIC.value)
2222
self.plan = PlanFactory(tier=self.tier, monthly_uploads_limit=250)

codecov_auth/commands/owner/interactors/tests/test_is_syncing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from unittest.mock import patch
22

33
from asgiref.sync import async_to_sync
4-
from django.test import TransactionTestCase
4+
from django.test import TestCase
55
from shared.django_apps.core.tests.factories import OwnerFactory
66

77
from ..is_syncing import IsSyncingInteractor
88

99

10-
class IsSyncingInteractorTest(TransactionTestCase):
10+
class IsSyncingInteractorTest(TestCase):
1111
def setUp(self):
1212
self.owner = OwnerFactory(username="codecov-user")
1313

codecov_auth/commands/owner/interactors/tests/test_onboard_user.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import pytest
2-
from django.test import TransactionTestCase
2+
from django.test import TestCase
33
from shared.django_apps.core.tests.factories import OwnerFactory
44

55
from codecov.commands.exceptions import Unauthenticated, Unauthorized, ValidationError
66
from codecov_auth.commands.owner.interactors.onboard_user import OnboardUserInteractor
77
from codecov_auth.models import OwnerProfile
88

99

10-
class OnboardUserInteractorTest(TransactionTestCase):
10+
class OnboardUserInteractorTest(TestCase):
1111
def setUp(self):
1212
self.owner = OwnerFactory(username="codecov-user")
1313
self.already_onboarded_owner = OwnerFactory(

codecov_auth/commands/owner/interactors/tests/test_regenerate_org_upload_token.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import pytest
2-
from django.test import TransactionTestCase
2+
from django.test import TestCase
33
from shared.django_apps.core.tests.factories import OwnerFactory
44

55
from codecov.commands.exceptions import Unauthenticated, Unauthorized, ValidationError
66

77
from ..regenerate_org_upload_token import RegenerateOrgUploadTokenInteractor
88

99

10-
class RegenerateOrgUploadTokenInteractorTest(TransactionTestCase):
10+
class RegenerateOrgUploadTokenInteractorTest(TestCase):
1111
def setUp(self):
1212
self.random_user = OwnerFactory()
1313
self.owner = OwnerFactory(username="codecovv", plan="users-enterprisem")

0 commit comments

Comments
 (0)