diff --git a/authentication/middleware.py b/authentication/middleware.py index a9c75facb1..e2c54c7283 100644 --- a/authentication/middleware.py +++ b/authentication/middleware.py @@ -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 diff --git a/channels/serializers_test.py b/channels/serializers_test.py index 2eb8882537..ab7da1b83f 100644 --- a/channels/serializers_test.py +++ b/channels/serializers_test.py @@ -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, ) diff --git a/conftest.py b/conftest.py index c569bd3fce..c0ce4157ce 100644 --- a/conftest.py +++ b/conftest.py @@ -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 diff --git a/fixtures/aws.py b/fixtures/aws.py index a0967415ea..c724a18322 100644 --- a/fixtures/aws.py +++ b/fixtures/aws.py @@ -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 diff --git a/fixtures/common.py b/fixtures/common.py index b99af80de1..ac1e5ab874 100644 --- a/fixtures/common.py +++ b/fixtures/common.py @@ -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. @@ -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") @@ -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) diff --git a/learning_resources/etl/podcast_test.py b/learning_resources/etl/podcast_test.py index 7ecae15b55..ebeef0c82d 100644 --- a/learning_resources/etl/podcast_test.py +++ b/learning_resources/etl/podcast_test.py @@ -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 """ @@ -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 """ diff --git a/learning_resources/etl/sloan_test.py b/learning_resources/etl/sloan_test.py index ea797eec2a..8bd68a1f28 100644 --- a/learning_resources/etl/sloan_test.py +++ b/learning_resources/etl/sloan_test.py @@ -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" diff --git a/learning_resources/etl/youtube_test.py b/learning_resources/etl/youtube_test.py index 7f3b1ccefd..16f0724db3 100644 --- a/learning_resources/etl/youtube_test.py +++ b/learning_resources/etl/youtube_test.py @@ -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( diff --git a/learning_resources/permissions_test.py b/learning_resources/permissions_test.py index d094e51fa8..684a4eb506 100644 --- a/learning_resources/permissions_test.py +++ b/learning_resources/permissions_test.py @@ -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 = "" diff --git a/main/middleware/feature_flags_test.py b/main/middleware/feature_flags_test.py index 11b6afca62..e6817d396f 100644 --- a/main/middleware/feature_flags_test.py +++ b/main/middleware/feature_flags_test.py @@ -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