django-rest-framework/tests
Stanislav Levin 36d5c0e74f
tests: Check urlpatterns after cleanups (#9400)
According to docs:
https://docs.python.org/3/library/unittest.html#unittest.TestCase.addClassCleanup

> Add a function to be called after tearDownClass() to cleanup resources
  used during the test class. Functions will be called in reverse order to
  the order they are added (LIFO).

This was revealed with recent change in pytest (`8.2.0`):
> pytest-dev/pytest#11728: For unittest-based tests, exceptions during
  class cleanup (as raised by functions registered with
  TestCase.addClassCleanup) are now reported instead of silently failing.

`check_urlpatterns` is called before `cleanup_url_patterns` and fails
(problem was hidden by `pytest < 8.2.0`).

`doClassCleanups` can be used instead to check after-cleanup state:

https://docs.python.org/3/library/unittest.html#unittest.TestCase.doClassCleanups

> This method is called unconditionally after tearDownClass(), or after
  setUpClass() if setUpClass() raises an exception.

  It is responsible for calling all the cleanup functions added by
  addClassCleanup(). If you need cleanup functions to be called prior to
  tearDownClass() then you can call doClassCleanups() yourself.

Fixes: https://github.com/encode/django-rest-framework/issues/9399

Signed-off-by: Stanislav Levin <slev@altlinux.org>
2024-05-07 13:05:03 +06:00
..
authentication Remove unused code 2024-04-30 18:28:22 +02:00
browsable_api Use POST method instead of GET to perform logout in browsable API (#9208) 2024-02-19 23:28:04 +01:00
generic_relations
importable
schemas Fix typo (#9231) 2024-01-24 23:17:01 +01:00
__init__.py
conftest.py Remove unused code 2024-04-30 18:28:22 +02:00
models.py
test_api_client.py
test_atomic_requests.py
test_authtoken.py
test_bound_fields.py
test_decorators.py Document support for http.HTTPMethod in the @action decorator added in Python 3.11. (#9067) 2023-08-15 11:50:02 +06:00
test_description.py Don't use Windows line endings 2024-04-30 18:28:27 +02:00
test_encoders.py
test_exceptions.py
test_fields.py Update deprecation hints 2024-04-30 18:28:23 +02:00
test_filters.py Align SearchFilter behaviour to django.contrib.admin search (#9017) 2023-07-25 19:01:23 +06:00
test_generics.py
test_htmlrenderer.py
test_lazy_hyperlinks.py
test_metadata.py Revert #9030 (#9333) 2024-03-22 09:40:34 +01:00
test_middleware.py
test_model_serializer.py Remove unused code 2024-04-30 18:28:22 +02:00
test_multitable_inheritance.py
test_negotiation.py
test_one_to_one_with_inheritance.py
test_pagination.py Revert "Ensure CursorPagination respects nulls in the ordering field (#8912)" (#9381) 2024-04-27 17:07:05 +06:00
test_parsers.py
test_permissions.py Revert "Fix Respect can_read_model permission in DjangoModelPermissions (#8…" (#9332) 2024-03-21 22:45:12 +00:00
test_prefetch_related.py Revert "Re-prefetch related objects after updating (#8043)" (#9327) 2024-03-21 22:23:30 +00:00
test_relations_hyperlink.py
test_relations_pk.py
test_relations_slug.py
test_relations.py Handle Nested Relation in SlugRelatedField when many=False (#8922) 2023-04-08 12:27:14 +06:00
test_renderers.py bump pygments (security hygiene) 2024-04-30 18:28:24 +02:00
test_request.py
test_requests_client.py
test_response.py Fix typo (#9231) 2024-01-24 23:17:01 +01:00
test_reverse.py
test_routers.py Use str as default path converter (#9066) 2023-08-16 20:11:50 +06:00
test_serializer_bulk_update.py
test_serializer_lists.py Allow to override child.run_validation call in ListSerializer (#8035) 2023-07-26 10:27:49 +06:00
test_serializer_nested.py Fix typo (#9231) 2024-01-24 23:17:01 +01:00
test_serializer.py Revert "Fix validation for ListSerializer (#8979)" (#9283) 2024-03-13 15:15:43 +00:00
test_settings.py
test_status.py
test_templates.py
test_templatetags.py
test_testing.py tests: Check urlpatterns after cleanups (#9400) 2024-05-07 13:05:03 +06:00
test_throttling.py pre-commit autoupdate (#9232) 2024-01-24 22:47:46 +01:00
test_urlpatterns.py
test_utils.py Fix type name of FieldInfo namedtuple (#9124) 2023-10-04 23:03:10 +06:00
test_validation_error.py Revert "feat: Add some changes to ValidationError to support django style vad…" (#9326) 2024-03-21 17:09:43 +01:00
test_validation.py
test_validators.py Add Django 5.0 support (#9233) 2024-02-28 11:52:22 +01:00
test_versioning.py Revert "Fix NamespaceVersioning ignoring DEFAULT_VERSION on non-None namespac…" (#9335) 2024-03-22 09:39:30 +00:00
test_views.py
test_viewsets.py Replaced OrderedDict with dict (#8964) 2023-04-30 15:20:02 +06:00
test_write_only_fields.py
urls.py
utils.py Handle Nested Relation in SlugRelatedField when many=False (#8922) 2023-04-08 12:27:14 +06:00