diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2018-10-10 07:40:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-10 07:40:14 (GMT) |
commit | 3058b7d85697f95573fa042d6b9e4d6e2a9e739c (patch) | |
tree | 6385f9dae930c5f5104d86e471f516d3f8258385 | |
parent | d0bb5d73cb2a44044cc314bc2cb68407b27eddb6 (diff) | |
download | cpython-3058b7d85697f95573fa042d6b9e4d6e2a9e739c.zip cpython-3058b7d85697f95573fa042d6b9e4d6e2a9e739c.tar.gz cpython-3058b7d85697f95573fa042d6b9e4d6e2a9e739c.tar.bz2 |
bpo-33613: Fix test_semaphore_tracker signal tests when using -Werror (GH-9778)
Tests involving sending signals to the semaphore_tracker will not fail anymore due to
the fact that running the test suite with -Werror propagates warnings as errors.
Fix a missing assertion when the semaphore_tracker is expected to die.
-rw-r--r-- | Lib/test/_test_multiprocessing.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 71f40a0..814aae8 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -4548,7 +4548,8 @@ class TestSemaphoreTracker(unittest.TestCase): if pid is not None: os.kill(pid, signal.SIGKILL) os.waitpid(pid, 0) - with warnings.catch_warnings(record=True) as all_warn: + with warnings.catch_warnings(): + warnings.simplefilter("ignore") _semaphore_tracker.ensure_running() pid = _semaphore_tracker._pid @@ -4557,6 +4558,7 @@ class TestSemaphoreTracker(unittest.TestCase): ctx = multiprocessing.get_context("spawn") with warnings.catch_warnings(record=True) as all_warn: + warnings.simplefilter("always") sem = ctx.Semaphore() sem.acquire() sem.release() @@ -4569,7 +4571,7 @@ class TestSemaphoreTracker(unittest.TestCase): if should_die: self.assertEqual(len(all_warn), 1) the_warn = all_warn[0] - issubclass(the_warn.category, UserWarning) + self.assertTrue(issubclass(the_warn.category, UserWarning)) self.assertTrue("semaphore_tracker: process died" in str(the_warn.message)) else: |