diff --git a/compliance/test_utils.py b/compliance/test_utils.py index 5308e719bf..40bf0e6202 100644 --- a/compliance/test_utils.py +++ b/compliance/test_utils.py @@ -33,6 +33,7 @@ def mock_cybersource_wsdl(mocked_responses, settings, service_version=SERVICE_VE Mocks the responses to achieve a functional WSDL """ # in order for zeep to load the wsdl, it will load the wsdl and the accompanying xsd definitions + # Note: open() defaults to read mode ("r") with open(f"{DATA_DIR}/CyberSourceTransaction_{service_version}.wsdl") as wsdl: # noqa: PTH123 mocked_responses.add( mocked_responses.GET, diff --git a/courses/serializers_test.py b/courses/serializers_test.py index 5bfb0e0a3a..57597e518b 100644 --- a/courses/serializers_test.py +++ b/courses/serializers_test.py @@ -6,7 +6,6 @@ import factory import pytest -import pytz from django.contrib.auth.models import AnonymousUser from cms.constants import FORMAT_ONLINE, FORMAT_OTHER @@ -107,7 +106,7 @@ def test_serialize_program( # noqa: PLR0913 non_live_run = CourseRunFactory.create( course=course1, - end_date=datetime.max.replace(tzinfo=pytz.utc), + end_date=datetime.max.replace(tzinfo=timezone.utc), expiration_date=None, live=False, ) diff --git a/courses/views_test.py b/courses/views_test.py index 87d65d4df3..7cb16e424f 100644 --- a/courses/views_test.py +++ b/courses/views_test.py @@ -282,6 +282,7 @@ def test_course_view( # noqa: PLR0913 url = reverse("user-dashboard") class_name = "enrolled" + # Note: UTF-8 is the default encoding in Python 3. assert ( f''.encode() in resp.content ) is has_button @@ -346,6 +347,7 @@ def test_program_view( # noqa: PLR0913 url = reverse("user-dashboard") class_name = "enrolled" + # Note: UTF-8 is the default encoding in Python 3. assert ( f''.encode() in resp.content ) is has_button diff --git a/ecommerce/management/commands/invalidate_payment_coupons.py b/ecommerce/management/commands/invalidate_payment_coupons.py index 9df911933d..3af1101340 100644 --- a/ecommerce/management/commands/invalidate_payment_coupons.py +++ b/ecommerce/management/commands/invalidate_payment_coupons.py @@ -61,6 +61,7 @@ def handle(self, *args, **kwargs): # noqa: ARG002 codes = Coupon.objects.filter(enabled=True, payment=payment).all() else: try: + # Note: open() defaults to read mode ("r") with open(kwargs["codefile"]) as file: # noqa: PTH123 procCodes = [line.strip() for line in file] except Exception as e: # noqa: BLE001 diff --git a/mitxpro/test_utils.py b/mitxpro/test_utils.py index 3e894c3722..447d6d4653 100644 --- a/mitxpro/test_utils.py +++ b/mitxpro/test_utils.py @@ -170,6 +170,7 @@ def create_tempfile_csv(rows_iter): writer = csv.writer(f, delimiter=",") for row in rows_iter: writer.writerow(row) + # Note: open() defaults to read mode ("r") with open(f.name) as user_csv: # noqa: PTH123 return SimpleUploadedFile( f.name, user_csv.read().encode("utf8"), content_type="application/csv"