Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 9, 2024
1 parent 7e655ca commit 948533e
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion authentication/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def process_exception(self, request, exception):

if url:
url += (
"?" in url and "&" or "?"
("?" in url and "&") or "?"
) + f"message={quote(message)}&backend={backend_name}"
return redirect(url)
return None
Expand Down
2 changes: 1 addition & 1 deletion channels/serializers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_create_channel(base_channel_data, channel_detail, channel_type):
"""
paths = sorted(
(p.learning_resource for p in LearningPathFactory.create_batch(2)),
key=lambda list: list.id, # noqa: A002
key=lambda list: list.id,
reverse=True,
)

Expand Down
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


@pytest.fixture(autouse=True)
def prevent_requests(mocker, request): # noqa: PT004
def prevent_requests(mocker, request):
"""Patch requests to error on request by default"""
if "mocked_responses" in request.fixturenames:
return
Expand Down
4 changes: 2 additions & 2 deletions fixtures/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@


@pytest.fixture(autouse=True)
def silence_s3_logging(): # noqa: PT004
def silence_s3_logging():
"""Only show S3 errors"""
logging.getLogger("botocore").setLevel(logging.ERROR)


@pytest.fixture
def mock_s3_fixture(): # noqa: PT004
def mock_s3_fixture():
"""Mock the S3 fixture for the duration of the test"""
with mock_aws():
yield
Expand Down
8 changes: 4 additions & 4 deletions fixtures/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@


@pytest.fixture(autouse=True)
def silence_factory_logging(): # noqa: PT004
def silence_factory_logging():
"""Only show factory errors"""
logging.getLogger("factory").setLevel(logging.ERROR)


@pytest.fixture(autouse=True)
def warnings_as_errors(): # noqa: PT004
def warnings_as_errors():
"""
Convert warnings to errors. This should only affect unit tests, letting pylint and other plugins
raise DeprecationWarnings without erroring.
Expand All @@ -53,7 +53,7 @@ def warnings_as_errors(): # noqa: PT004


@pytest.fixture
def randomness(): # noqa: PT004
def randomness():
"""Ensure a fixed seed for factoryboy"""
factory.fuzzy.reseed_random("happy little clouds")

Expand Down Expand Up @@ -95,7 +95,7 @@ def mocked_responses():


@pytest.fixture
def offeror_featured_lists(): # noqa: PT004
def offeror_featured_lists():
"""Generate featured offeror lists for testing"""
for offered_by in OfferedBy.names():
offeror = LearningResourceOfferorFactory.create(code=offered_by)
Expand Down
4 changes: 2 additions & 2 deletions learning_resources/etl/podcast_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def mock_podcast_file( # pylint: disable=too-many-arguments # noqa: PLR0913


@pytest.fixture
def mock_rss_request(mocker): # noqa: PT004
def mock_rss_request(mocker):
"""
Mock request data
"""
Expand All @@ -76,7 +76,7 @@ def mock_rss_request(mocker): # noqa: PT004


@pytest.fixture
def mock_rss_request_with_bad_rss_file(mocker): # noqa: PT004
def mock_rss_request_with_bad_rss_file(mocker):
"""
Mock request data
"""
Expand Down
2 changes: 1 addition & 1 deletion learning_resources/etl/sloan_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@


@pytest.fixture(autouse=True)
def mock_sloan_api_setting(settings): # noqa: PT004
def mock_sloan_api_setting(settings):
"""Set the prolearn api url"""
settings.SEE_API_URL = "http://localhost/test/programs/api"
settings.SEE_API_CLIENT_ID = "test"
Expand Down
2 changes: 1 addition & 1 deletion learning_resources/etl/youtube_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def mock_channel_file(content):


@pytest.fixture
def mocked_github_channel_response(mocker): # noqa: PT004
def mocked_github_channel_response(mocker):
"""Mock response from github api requst to open-video-data"""

mock_file = mock_channel_file(
Expand Down
2 changes: 1 addition & 1 deletion learning_resources/permissions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


@pytest.fixture(autouse=True)
def drf_settings(settings): # noqa: PT004
def drf_settings(settings):
"""Default drf prefix setting""" # noqa: D401
settings.DRF_NESTED_PARENT_LOOKUP_PREFIX = ""

Expand Down
2 changes: 1 addition & 1 deletion main/middleware/feature_flags_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


@pytest.fixture
def middleware_settings(settings): # noqa: PT004
def middleware_settings(settings):
"""Default settings for middleware""" # noqa: D401
settings.MIDDLEWARE_FEATURE_FLAG_QS_PREFIX = "ZZ"
settings.MIDDLEWARE_FEATURE_FLAG_COOKIE_NAME = FEATURE_FLAG_COOKIE_NAME
Expand Down

0 comments on commit 948533e

Please sign in to comment.