8000 gh-115490: Make the interpreter.channels and interpreter.queues Modules Handle Reloading Properly by ericsnowcurrently · Pull Request #115493 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-115490: Make the interpreter.channels and interpreter.queues Modules Handle Reloading Properly #115493

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

Merged
Prev Previous commit
Next Next commit
Add tests.
  • Loading branch information
ericsnowcurrently committed Mar 4, 2024
commit 46d1243d88c9131bd16b09190beacf5798b95761
5 changes: 5 additions & 0 deletions Lib/test/test__xxinterpchannels.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
channels = import_helper.import_module('_xxinterpchannels')


# Additional tests are found in Lib/test/test_interpreters/test_channels.py.
# New tests should be added there.
# XXX The tests here should be moved there. See the note under LowLevelTests.


##################################
# helpers

Expand Down
19 changes: 19 additions & 0 deletions Lib/test/test_interpreters/test_channels.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import importlib
import threading
from textwrap import dedent
import unittest
Expand All @@ -11,6 +12,24 @@
from .utils import _run_output, TestBase


class LowLevelTests(TestBase):

# The behaviors in the low-level module is important in as much
# as it is exercised by the high-level module. Therefore the
# most # important testing happens in the high-level tests.
# These low-level tests cover corner cases that are not
# encountered by the high-level module, thus they
# mostly shouldn't matter as much.

# Additional tests are found in Lib/test/test__xxinterpchannels.py.
# XXX Those should be either moved to LowLevelTests or eliminated
# in favor of high-level tests in this file.

def test_highlevel_reloaded(self):
# See gh-115490 (https://github.com/python/cpython/issues/115490).
importlib.reload(channels)


class TestChannels(TestBase):

def test_create(self):
Expand Down
14 changes: 14 additions & 0 deletions Lib/test/test_interpreters/test_queues.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import importlib
import threading
from textwrap import dedent
import unittest
Expand All @@ -20,6 +21,19 @@ def tearDown(self):
pass


class LowLevelTests(TestBase):

# The behaviors in the low-level module is important in as much
# as it is exercised by the high-level module. Therefore the
# most # important testing happens in the high-level tests.
# These low-level tests cover corner cases that are not
# encountered by the high-level module, thus they
# mostly shouldn't matter as much.

def test_highlevel_reloaded(self):
importlib.reload(queues)


class QueueTests(TestBase):

def test_create(self):
Expand Down
0