Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove broken and deprecated CFGOVPage unit test #8461

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

chosak
Copy link
Member

@chosak chosak commented Jun 10, 2024

This unit test was failing for me with certain invocations of Python unit tests, for example:

tox -e unittest -- v1.tests.models.test_base

This fails due to a RecursionError in Django's settings code, whereas running those tests in reverse passed:

tox -e unittest -- --reverse v1.tests.models.test_base

Digging into this, the problem is that this test patches the Python super() call which has all sorts of potential side effects. In this case, it was breaking something about how Django settings are cached the first time they are accessed.

As it turns out, this test can be removed - it was created at a time when our CFGOVPage.serve() method was sometimes invoked via AJAX, which is no longer the case.

Notes and todos

We have a few other tests that also patch builtins.super() in this way. These should also be changed to avoid this approach, as it's a very broad brush with all sorts of unpredictable side effects.

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code follows the standards laid out in the CFPB development guidelines

This unit test was failing for me with certain invocations of Python
unit tests, for example:

tox -e unittest -- v1.tests.models.test_base

This fails due to a RecursionError in Django's settings code, whereas
running those tests in reverse passed:

tox -e unittest -- --reverse v1.tests.models.test_base

Digging into this, the problem is that this test patches the Python
super() call which has all sorts of potential side effects. In this
case, it was breaking something about how Django settings are cached
the first time they are accessed.

As it turns out, this test can be removed - it was created at a time
when our CFGOVPage.serve() method was sometimes invoked via AJAX, which
is no longer the case.
@chosak chosak added this pull request to the merge queue Jun 11, 2024
Merged via the queue into main with commit 7e454c6 Jun 11, 2024
12 checks passed
@chosak chosak deleted the deprecate/broken-super-test branch June 11, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants