fix: restore all events in OpenEdxEventsTestMixin.tearDownClass#559
Merged
mariajgrimaldi merged 3 commits intomainfrom Apr 9, 2026
Merged
Conversation
OpenEdxEventsTestMixin.setUpClass() disables all OpenEdX events then enables only those listed in ENABLED_OPENEDX_EVENTS, but had no corresponding tearDownClass to restore event state. This caused any events left disabled to remain disabled for subsequent test classes running in the same process. Add tearDownClass to re-enable all events so that test classes using this mixin do not leak disabled event state into other tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ation Verify that tearDownClass re-enables all events so subsequent test classes running in the same process are not affected by the mixin's event isolation — the regression that motivated the tearDownClass fix. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
238e42f to
0336d08
Compare
feanil
added a commit
to openedx/openedx-platform
that referenced
this pull request
Apr 8, 2026
…vents.testing openedx_events/tests/utils.py was moved to openedx_events/testing.py in openedx/openedx-events#559 so the test utilities are included in the installed package (setup.py excludes the tests/ subpackage from the wheel). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feanil
added a commit
to openedx/openedx-platform
that referenced
this pull request
Apr 8, 2026
Pins openedx-events to the openedx/openedx-events#559 branch which contains two fixes not yet in a released version: - tearDownClass added to OpenEdxEventsTestMixin to restore event state - Test utilities moved to openedx_events.testing so they are included in the installed package (setup.py excludes tests/ from the wheel) Revert to unpinned once openedx/openedx-events#559 is merged and released as 11.1.1. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
openedx_events/tests/utils.py was excluded from the installed package by the exclude=["*tests"] in setup.py (introduced in #557), breaking downstream consumers that import from openedx_events.tests.utils. Move the public test utilities to openedx_events/testing.py so they are included in the installed package. New import paths: from openedx_events.testing import FreezeSignalCacheMixin from openedx_events.testing import EventsIsolationMixin from openedx_events.testing import OpenEdxEventsTestMixin Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3e475c1 to
171ce95
Compare
feanil
added a commit
to openedx/openedx-platform
that referenced
this pull request
Apr 9, 2026
…vents.testing openedx_events/tests/utils.py was moved to openedx_events/testing.py in openedx/openedx-events#559 so the test utilities are included in the installed package (setup.py excludes the tests/ subpackage from the wheel). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feanil
added a commit
to openedx/openedx-platform
that referenced
this pull request
Apr 10, 2026
…vents.testing openedx_events/tests/utils.py was moved to openedx_events/testing.py in openedx/openedx-events#559 so the test utilities are included in the installed package (setup.py excludes the tests/ subpackage from the wheel). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feanil
added a commit
to openedx/openedx-platform
that referenced
this pull request
Apr 10, 2026
…vents.testing openedx_events/tests/utils.py was moved to openedx_events/testing.py in openedx/openedx-events#559 so the test utilities are included in the installed package (setup.py excludes the tests/ subpackage from the wheel). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feanil
added a commit
to openedx/openedx-platform
that referenced
this pull request
Apr 11, 2026
…vents.testing openedx_events/tests/utils.py was moved to openedx_events/testing.py in openedx/openedx-events#559 so the test utilities are included in the installed package (setup.py excludes the tests/ subpackage from the wheel). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feanil
added a commit
to openedx/openedx-platform
that referenced
this pull request
Apr 14, 2026
…vents.testing openedx_events/tests/utils.py was moved to openedx_events/testing.py in openedx/openedx-events#559 so the test utilities are included in the installed package (setup.py excludes the tests/ subpackage from the wheel). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OpenEdxEventsTestMixin.setUpClass()disables all OpenEdX events then enables only those inENABLED_OPENEDX_EVENTS, but had notearDownClassto restore event state. This meant that after any test class using this mixin completed, all events not inENABLED_OPENEDX_EVENTSremained globally disabled for the remainder of the process.This was discovered in openedx-platform when shard rebalancing caused
lms/djangoapps/certificates/andlms/djangoapps/discussion/django_comment_client/to run in the same process for the first time. Nine certificate test classes withENABLED_OPENEDX_EVENTS = []left all events disabled, causingForumEventTestCase.test_comment_eventto fail with:because
FORUM_RESPONSE_COMMENT_CREATEDwas never fired (it had been disabled).Fix
tearDownClasstoOpenEdxEventsTestMixinthat callsenable_all_events(), mirroring the disable insetUpClass. This is consistent with the pattern already used byFreezeSignalCacheMixinin the same file.openedx-platformwhen it's released. See the refactor commit message for more details.