diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-06-17 14:18:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-17 14:18:43 +0200 |
commit | 8bf08ee45b7c2341f0d0175b91892843a37c23da (patch) | |
tree | 30e7d5b52c8e622d62e80ecaf2b6111f737bbaaa /Lib/test/test_dummy_threading.py | |
parent | 2e9954d3472a23919b96323fcd5bb6c1d6927155 (diff) | |
download | cpython-git-8bf08ee45b7c2341f0d0175b91892843a37c23da.tar.gz |
bpo-37312: Remove _dummy_thread and dummy_threading modules (GH-14143)
Remove _dummy_thread and dummy_threading modules. These modules
were deprecated since Python 3.7 which requires threading support.
Diffstat (limited to 'Lib/test/test_dummy_threading.py')
-rw-r--r-- | Lib/test/test_dummy_threading.py | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/Lib/test/test_dummy_threading.py b/Lib/test/test_dummy_threading.py deleted file mode 100644 index a0c2972a60..0000000000 --- a/Lib/test/test_dummy_threading.py +++ /dev/null @@ -1,60 +0,0 @@ -from test import support -import unittest -import dummy_threading as _threading -import time - -class DummyThreadingTestCase(unittest.TestCase): - - class TestThread(_threading.Thread): - - def run(self): - global running - global sema - global mutex - # Uncomment if testing another module, such as the real 'threading' - # module. - #delay = random.random() * 2 - delay = 0 - if support.verbose: - print('task', self.name, 'will run for', delay, 'sec') - sema.acquire() - mutex.acquire() - running += 1 - if support.verbose: - print(running, 'tasks are running') - mutex.release() - time.sleep(delay) - if support.verbose: - print('task', self.name, 'done') - mutex.acquire() - running -= 1 - if support.verbose: - print(self.name, 'is finished.', running, 'tasks are running') - mutex.release() - sema.release() - - def setUp(self): - self.numtasks = 10 - global sema - sema = _threading.BoundedSemaphore(value=3) - global mutex - mutex = _threading.RLock() - global running - running = 0 - self.threads = [] - - def test_tasks(self): - for i in range(self.numtasks): - t = self.TestThread(name="<thread %d>"%i) - self.threads.append(t) - t.start() - - if support.verbose: - print('waiting for all tasks to complete') - for t in self.threads: - t.join() - if support.verbose: - print('all tasks done') - -if __name__ == '__main__': - unittest.main() |