Skip to content

Commit 22de004

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent aa1e2f8 commit 22de004

File tree

18 files changed

+51
-51
lines changed

18 files changed

+51
-51
lines changed

src/common/mitol/common/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def update(self, **kwargs):
3131
Automatically update updated_on timestamp when .update(). This is because .update()
3232
does not go through .save(), thus will not auto_now, because it happens on the
3333
database level without loading objects into memory.
34-
""" # noqa: E501, D402
34+
""" # noqa: E501
3535
if "updated_on" not in kwargs:
3636
kwargs["updated_on"] = now_in_utc()
3737
return super().update(**kwargs)

src/google_sheets_deferrals/mitol/google_sheets_deferrals/management/commands/process_deferral_requests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def handle(self, *args, **options): # noqa: ARG002
2424
deferral_request_handler = DeferralRequestHandler()
2525
self.stdout.write("Handling refunds and updating spreadsheet...")
2626
results = deferral_request_handler.process_sheet(
27-
limit_row_index=options.get("row", None)
27+
limit_row_index=options.get("row")
2828
)
2929
self.stdout.write(
3030
self.style.SUCCESS(f"Deferral sheet successfully processed.\n{results}")

src/google_sheets_refunds/mitol/google_sheets_refunds/management/commands/process_refund_requests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def handle(self, *args, **options): # noqa: ARG002
2424
refund_request_handler = RefundRequestHandler()
2525
self.stdout.write("Handling refunds and updating spreadsheet...")
2626
results = refund_request_handler.process_sheet(
27-
limit_row_index=options.get("row", None)
27+
limit_row_index=options.get("row")
2828
)
2929
self.stdout.write(
3030
self.style.SUCCESS(f"Refund sheet successfully processed.\n{results}")

tests/conftest.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
@pytest.fixture(scope="session")
13-
def django_db_modify_db_settings_pants_suffix() -> None: # noqa: PT004
13+
def django_db_modify_db_settings_pants_suffix() -> None:
1414
skip_if_no_django()
1515

1616
slot_id = environ.get("PANTS_EXECUTION_SLOT", None)
@@ -20,13 +20,13 @@ def django_db_modify_db_settings_pants_suffix() -> None: # noqa: PT004
2020

2121

2222
@pytest.fixture(scope="session")
23-
def django_db_modify_db_settings_parallel_suffix( # noqa: PT004
23+
def django_db_modify_db_settings_parallel_suffix(
2424
django_db_modify_db_settings_pants_suffix, # noqa: ARG001
2525
) -> None:
2626
skip_if_no_django()
2727

2828

29-
@pytest.fixture()
29+
@pytest.fixture
3030
def learner_drf_client(learner):
3131
"""DRF API test client that is authenticated with the user"""
3232
# import is here to avoid trying to load django before settings are initialized
@@ -37,7 +37,7 @@ def learner_drf_client(learner):
3737
return client
3838

3939

40-
@pytest.fixture()
40+
@pytest.fixture
4141
def learner(db): # noqa: ARG001
4242
"""Fixture for a default learner"""
4343
# import is here to avoid trying to load django before settings are initialized
@@ -46,7 +46,7 @@ def learner(db): # noqa: ARG001
4646
return UserFactory.create()
4747

4848

49-
@pytest.fixture()
49+
@pytest.fixture
5050
def learner_and_oauth2(learner):
5151
"""Fixture for a default learner and oauth2 records"""
5252
# import is here to avoid trying to load django before settings are initialized
@@ -72,31 +72,31 @@ def learner_and_oauth2(learner):
7272
)
7373

7474

75-
@pytest.fixture()
75+
@pytest.fixture
7676
def staff_user(db): # noqa: ARG001
7777
"""Staff user fixture"""
7878
from mitol.common.factories import UserFactory
7979

8080
return UserFactory.create(is_staff=True)
8181

8282

83-
@pytest.fixture()
83+
@pytest.fixture
8484
def user_client(learner):
8585
"""Django test client that is authenticated with the user"""
8686
client = Client()
8787
client.force_login(learner)
8888
return client
8989

9090

91-
@pytest.fixture()
91+
@pytest.fixture
9292
def staff_client(staff_user):
9393
"""Django test client that is authenticated with the staff user"""
9494
client = Client()
9595
client.force_login(staff_user)
9696
return client
9797

9898

99-
@pytest.fixture()
99+
@pytest.fixture
100100
def google_sheets_base_settings(settings):
101101
"""Fixture for base google sheets settings"""
102102
settings.MITOL_GOOGLE_SHEETS_ENROLLMENT_CHANGE_SHEET_ID = "1"
@@ -106,14 +106,14 @@ def google_sheets_base_settings(settings):
106106
return settings
107107

108108

109-
@pytest.fixture()
109+
@pytest.fixture
110110
def google_sheets_service_creds_settings(settings):
111111
"""Fixture for google sheets settings configured for a service account"""
112112
settings.MITOL_GOOGLE_SHEETS_DRIVE_SERVICE_ACCOUNT_CREDS = '{"credentials": "json"}'
113113
return settings
114114

115115

116-
@pytest.fixture()
116+
@pytest.fixture
117117
def google_sheets_client_creds_settings(settings):
118118
"""Fixture gor google sheets settings configured with OAuth"""
119119
settings.MITOL_GOOGLE_SHEETS_DRIVE_CLIENT_ID = "nhijg1i.apps.googleusercontent.com"

tests/mitol/authentication/views/test_djoser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
EMAIL = "email@example.com"
1010

1111

12-
@pytest.fixture()
12+
@pytest.fixture
1313
def user():
1414
from mitol.common.factories import UserFactory
1515

tests/mitol/common/templates/test_render_bundle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626

2727
@pytest.fixture(autouse=True)
28-
def dont_disable_webpack(settings): # noqa: PT004
28+
def dont_disable_webpack(settings):
2929
"""Re-enable webpack loader stats for these tests."""
3030
settings.WEBPACK_DISABLE_LOADER_STATS = False
3131

tests/mitol/common/test_envs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232

3333
@pytest.fixture(autouse=True)
34-
def clean_env(mocker): # noqa: PT004
34+
def clean_env(mocker):
3535
"""Clean the configured environment variables before a test"""
3636
mocker.patch.dict("os.environ", FAKE_ENVIRONS, clear=True)
3737
envs.env.reload()

tests/mitol/common/utils/test_collections.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def __init__(self, make, model):
230230

231231
def test_chunks():
232232
"""
233-
test for chunks
233+
Test for chunks
234234
"""
235235
input_list = list(range(113))
236236
output_list = []
@@ -251,7 +251,7 @@ def test_chunks():
251251

252252
def test_chunks_iterable():
253253
"""
254-
test that chunks works on non-list iterables too
254+
Test that chunks works on non-list iterables too
255255
"""
256256
count = 113
257257
input_range = range(count)

tests/mitol/digitalcredentials/test_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_build_api_url_invalid(settings):
3030
build_api_url("/path")
3131

3232

33-
@pytest.mark.django_db()
33+
@pytest.mark.django_db
3434
def test_create_deep_link_url(settings):
3535
"""Test create_deep_link_url()"""
3636
settings.MITOL_DIGITAL_CREDENTIALS_AUTH_TYPE = "test_auth_type"

tests/mitol/geoip/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
fake = faker.Factory.create()
1313

1414

15-
@pytest.mark.django_db()
15+
@pytest.mark.django_db
1616
@pytest.mark.parametrize(
1717
"v4,in_block", # noqa: PT006
1818
[

tests/mitol/google_sheets/test_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from mitol.google_sheets.factories import GoogleApiAuthFactory
99

1010

11-
@pytest.mark.django_db()
11+
@pytest.mark.django_db
1212
def test_get_credentials_service_account(mocker, settings):
1313
"""
1414
get_credentials should construct a valid Credentials object from app settings using Service Account auth
@@ -35,7 +35,7 @@ def test_get_credentials_service_account(mocker, settings):
3535
assert creds == patched_svc_account_creds.from_service_account_info.return_value
3636

3737

38-
@pytest.mark.django_db()
38+
@pytest.mark.django_db
3939
def test_get_credentials_personal_auth(settings):
4040
"""
4141
get_credentials should construct a valid Credentials object from data and app settings using personal

tests/mitol/google_sheets/test_views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
lazy = lazy_fixture
1414

1515

16-
@pytest.fixture()
16+
@pytest.fixture
1717
def google_api_auth(learner):
1818
"""Fixture that creates a google auth object"""
1919
return GoogleApiAuthFactory.create(requesting_user=learner)
@@ -53,7 +53,7 @@ def test_request_auth(mocker, settings, staff_client):
5353

5454

5555
@pytest.mark.parametrize("existing_auth", [lazy("google_api_auth"), None])
56-
@pytest.mark.django_db()
56+
@pytest.mark.django_db
5757
def test_complete_auth(mocker, settings, learner, existing_auth): # noqa: ARG001
5858
"""
5959
View that handles Google auth completion should fetch a token and save/update a

tests/mitol/google_sheets_deferrals/test_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pytest_lazy_fixtures import lf as lazy_fixture
1515

1616

17-
@pytest.fixture()
17+
@pytest.fixture
1818
def request_csv_rows(settings):
1919
"""Fake deferral request spreadsheet data rows (loaded from CSV)"""
2020
fake_request_csv_filepath = os.path.join( # noqa: PTH118
@@ -25,7 +25,7 @@ def request_csv_rows(settings):
2525
return [line.split(",") for i, line in enumerate(f.readlines()) if i > 0]
2626

2727

28-
@pytest.fixture()
28+
@pytest.fixture
2929
def pygsheets_fixtures(mocker, db, request_csv_rows): # noqa: ARG001
3030
"""Patched functions for pygsheets client functionality"""
3131
Mock = mocker.Mock
@@ -60,7 +60,7 @@ def pygsheets_fixtures(mocker, db, request_csv_rows): # noqa: ARG001
6060
)
6161

6262

63-
@pytest.fixture()
63+
@pytest.fixture
6464
def google_sheets_deferral_settings(settings):
6565
settings.MITOL_GOOGLE_SHEETS_DEFERRALS_REQUEST_WORKSHEET_ID = "1"
6666
settings.MITOL_GOOGLE_SHEETS_DEFERRALS_PLUGINS = "app.plugins.DeferralPlugin"

tests/mitol/google_sheets_refunds/test_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pytest_lazy_fixtures import lf as lazy_fixture
1515

1616

17-
@pytest.fixture()
17+
@pytest.fixture
1818
def request_csv_rows(settings):
1919
"""Fake refund request spreadsheet data rows (loaded from CSV)"""
2020
fake_request_csv_filepath = os.path.join( # noqa: PTH118
@@ -25,7 +25,7 @@ def request_csv_rows(settings):
2525
return [line.split(",") for i, line in enumerate(f.readlines()) if i > 0]
2626

2727

28-
@pytest.fixture()
28+
@pytest.fixture
2929
def pygsheets_fixtures(mocker, db, request_csv_rows): # noqa: ARG001
3030
"""Patched functions for pygsheets client functionality"""
3131
Mock = mocker.Mock
@@ -60,7 +60,7 @@ def pygsheets_fixtures(mocker, db, request_csv_rows): # noqa: ARG001
6060
)
6161

6262

63-
@pytest.fixture()
63+
@pytest.fixture
6464
def google_sheets_refunds_settings(settings):
6565
settings.MITOL_GOOGLE_SHEETS_REFUNDS_REQUEST_WORKSHEET_ID = "1"
6666
settings.MITOL_GOOGLE_SHEETS_REFUNDS_PLUGINS = "app.plugins.RefundPlugin"

tests/mitol/hubspot_api/test_api.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,25 @@
2727
test_object_type = "deals"
2828

2929

30-
@pytest.fixture()
30+
@pytest.fixture
3131
def property_group():
3232
"""Return sample group JSON"""
3333
return {"name": "group_name", "label": "Group Label"}
3434

3535

36-
@pytest.fixture()
36+
@pytest.fixture
3737
def content_type_obj():
3838
"""Return a sample ContentType"""
3939
return ContentType.objects.get_for_model(Group)
4040

4141

42-
@pytest.fixture()
42+
@pytest.fixture
4343
def mock_hubspot_api(mocker):
4444
"""Mock the send hubspot request method"""
4545
return mocker.patch("mitol.hubspot_api.api.HubspotApi")
4646

4747

48-
@pytest.fixture()
48+
@pytest.fixture
4949
def mock_search_object(mocker):
5050
"""Return a mocked PublicObjectSearchRequest"""
5151
return mocker.patch("mitol.hubspot_api.api.PublicObjectSearchRequest")
@@ -196,7 +196,7 @@ def test_delete_object_property(mock_hubspot_api, property_group):
196196
assert result == 204 # noqa: PLR2004
197197

198198

199-
@pytest.mark.django_db()
199+
@pytest.mark.django_db
200200
def test_get_hubspot_id():
201201
"""Return the hubspot id if any for the specified content type and object ID"""
202202
hubspot_obj = HubspotObjectFactory.create()
@@ -214,7 +214,7 @@ def test_format_app_id(settings, prefix):
214214
assert api.format_app_id(object_id) == f"{prefix}-{object_id}"
215215

216216

217-
@pytest.mark.django_db()
217+
@pytest.mark.django_db
218218
def test_upsert_object_request_new(mock_hubspot_api, content_type_obj):
219219
"""A HubspotObject should be created after an object is synced for the first time"""
220220
hubspot_id = "123456789"
@@ -234,7 +234,7 @@ def test_upsert_object_request_new(mock_hubspot_api, content_type_obj):
234234
)
235235

236236

237-
@pytest.mark.django_db()
237+
@pytest.mark.django_db
238238
def test_upsert_object_request_exists(mock_hubspot_api):
239239
"""upsert_object_request should try a patch hubspot API call if there's an existing Hubspot object""" # noqa: E501
240240
hs_obj = HubspotObjectFactory.create()
@@ -264,7 +264,7 @@ def test_upsert_object_request_exists(mock_hubspot_api):
264264
api.HubspotObjectType.CONTACTS.value,
265265
],
266266
)
267-
@pytest.mark.django_db()
267+
@pytest.mark.django_db
268268
def test_upsert_object_request_missing_id( # noqa: PLR0913
269269
mocker, mock_hubspot_api, content_type_obj, status, message, hs_type
270270
):
@@ -303,7 +303,7 @@ def test_upsert_object_request_missing_id( # noqa: PLR0913
303303
)
304304

305305

306-
@pytest.mark.django_db()
306+
@pytest.mark.django_db
307307
def test_upsert_object_request_other_error(mocker, mock_hubspot_api, content_type_obj):
308308
"""If a non-dupe ApIException happens, raise it"""
309309
object_id = 123
@@ -330,7 +330,7 @@ def test_upsert_object_request_other_error(mocker, mock_hubspot_api, content_typ
330330

331331

332332
@pytest.mark.parametrize("is_primary_email", [True, False])
333-
@pytest.mark.django_db()
333+
@pytest.mark.django_db
334334
def test_upsert_object_contact_dupe_email(mocker, mock_hubspot_api, is_primary_email):
335335
"""If single hubspot contact has multiple emails matching 2+ django users, delete the other email""" # noqa: E501
336336
dupe_hubspot_id = "123456789"

tests/mitol/mail/test_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
User = get_user_model()
2020

2121

22-
@pytest.fixture()
23-
def email_settings(settings): # noqa: PT004
22+
@pytest.fixture
23+
def email_settings(settings):
2424
"""Default settings for email tests""" # noqa: D401
2525
settings.MITOL_MAIL_RECIPIENT_OVERRIDE = None
2626

tests/mitol/mail/test_messages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class NoTemplateNameMessage(TemplatedMessage):
1717

1818

1919
@pytest.fixture(autouse=True)
20-
def default_settings(settings): # noqa: PT004
20+
def default_settings(settings):
2121
"""Default settings for tests""" # noqa: D401
2222
settings.SITE_BASE_URL = "http://mit.edu/"
2323
settings.SITE_NAME = "MIT"

0 commit comments

Comments
 (0)