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 Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
importable Fix lazy translation of ListField errors (#6708) 2019-05-22 19:41:53 -07:00
schemas Fix typo (#9231) 2024-01-24 23:17:01 +01:00
__init__.py Support for running the test suite with py.test 2014-03-02 12:40:30 +01:00
conftest.py Remove unused code 2024-04-30 18:28:22 +02:00
models.py Fixes instance check in ListSerializer.to_representation (#8726) (#8727) 2022-11-22 12:01:01 +06:00
test_api_client.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_atomic_requests.py support multi db atomic_requests (#7739) 2021-03-03 11:15:39 +00:00
test_authtoken.py Fix: authtoken.TokenProxy cannot be proxy when not installed (#7571) 2020-10-09 12:16:15 +01:00
test_bound_fields.py Render JSON fields with proper indentation in browsable API forms. (#6243) 2021-03-15 10:44:03 +00:00
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 Confirmed support for Django 4.1. (#8498) 2022-06-06 12:39:06 +01:00
test_exceptions.py Replace all usage ugettext functions with the non-u versions (#6634) 2019-05-01 07:49:54 +02:00
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 Allow generic requests, responses, fields, views (#8825) 2023-02-22 21:39:01 +06:00
test_htmlrenderer.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_lazy_hyperlinks.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_metadata.py Revert #9030 (#9333) 2024-03-22 09:40:34 +01:00
test_middleware.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_model_serializer.py Remove unused code 2024-04-30 18:28:22 +02:00
test_multitable_inheritance.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
test_negotiation.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
test_one_to_one_with_inheritance.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
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 Drop default 'utf-8' to .encode()/.decode() (#6633) 2019-05-01 07:49:16 +02:00
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 Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_relations_pk.py Fix pk-only optimization for properties (#7142) 2020-09-03 11:49:15 +01:00
test_relations_slug.py fix wrong assert 2017-01-21 02:25:36 +06:00
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 Allow generic requests, responses, fields, views (#8825) 2023-02-22 21:39:01 +06:00
test_requests_client.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
test_response.py Fix typo (#9231) 2024-01-24 23:17:01 +01:00
test_reverse.py Inherit from faked classes in tests to satisfy mypy (#8859) 2023-01-28 17:18:58 +06:00
test_routers.py Use str as default path converter (#9066) 2023-08-16 20:11:50 +06:00
test_serializer_bulk_update.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
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 Added pagination settings test case (#8362) 2022-11-22 14:18:47 +06:00
test_status.py converted assertion to pytest style in test status (#8769) 2022-11-21 11:32:07 +00:00
test_templates.py Avoid inline script execution for injecting CSRF token (#7016) 2022-11-29 16:10:32 +00:00
test_templatetags.py Update test_templatetags.py 2020-09-30 09:10:36 +01:00
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 Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
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 Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
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 Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
test_viewsets.py Replaced OrderedDict with dict (#8964) 2023-04-30 15:20:02 +06:00
test_write_only_fields.py tests: remove some dead code, use assert 0 for never called methods (#5973) 2018-05-08 13:28:46 +01:00
urls.py Replace all url() calls with path() or re_path() (#7512) 2020-09-08 15:32:27 +01:00
utils.py Handle Nested Relation in SlugRelatedField when many=False (#8922) 2023-04-08 12:27:14 +06:00