diff options
author | Tim Harder <radhermit@gmail.com> | 2021-03-15 00:06:57 -0600 |
---|---|---|
committer | Tim Harder <radhermit@gmail.com> | 2021-03-15 00:08:13 -0600 |
commit | 0bc0e8b9f74a55470dc125ba4b975f26c6438029 (patch) | |
tree | d21a0da404a254929d804af2105c61cf3cd435a6 /tests | |
parent | bump version (diff) | |
download | snakeoil-0bc0e8b9f74a55470dc125ba4b975f26c6438029.tar.gz snakeoil-0bc0e8b9f74a55470dc125ba4b975f26c6438029.tar.bz2 snakeoil-0bc0e8b9f74a55470dc125ba4b975f26c6438029.zip |
process: drop unused is_running()
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_process.py | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/tests/test_process.py b/tests/test_process.py index 445e2381..8820f9ad 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -61,43 +61,3 @@ class TestFindBinary(TempDir): process.find_binary(os.path.basename(self.dir), os.path.dirname(self.dir)) with pytest.raises(process.CommandNotFound): process.find_binary(self.dir) - - -class TestIsRunning: - - def test_is_running(self): - # confirm we're running - assert process.is_running(os.getpid()) - - # fork a new process, SIGSTOP it, and confirm it's not running - pid = os.fork() - if pid == 0: - os.kill(os.getpid(), signal.SIGSTOP) - else: - # wait for signal to propagate - time.sleep(1) - # The return value is reliable only on Linux, on other systems just - # make sure ProcessNotFound isn't thrown. - if sys.platform.startswith('linux'): - assert not process.is_running(pid) - else: - process.is_running(pid) - os.kill(pid, signal.SIGKILL) - - with mock.patch('snakeoil.process.os.kill') as kill: - kill.side_effect = OSError(3, 'No such process') - with pytest.raises(process.ProcessNotFound): - process.is_running(1234) - - kill.side_effect = OSError(4, 'Interrupted system call') - with pytest.raises(OSError): - process.is_running(1234) - - with mock.patch('builtins.open') as open: - open.side_effect = OSError(2, 'No such file or directory') - with pytest.raises(process.ProcessNotFound): - process.is_running(os.getpid()) - - open.side_effect = OSError(5, 'Input/output error') - with pytest.raises(OSError): - process.is_running(os.getpid()) |