Implements More Tests for the DiceInterface Class
This commit is contained in:
0
tests/mocks/__init__.py
Normal file
0
tests/mocks/__init__.py
Normal file
31
tests/mocks/mock_proc.py
Normal file
31
tests/mocks/mock_proc.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from typing import List
|
||||
import itertools
|
||||
|
||||
|
||||
class MockProc:
|
||||
pid_counter = itertools.count()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.pid = next(MockProc.pid_counter)
|
||||
|
||||
if 'exitcode' in kwargs:
|
||||
self.exitcode = kwargs['exitcode']
|
||||
else:
|
||||
self.exitcode = 0
|
||||
|
||||
self.sentinel = self.pid
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return self
|
||||
|
||||
def start(self):
|
||||
pass
|
||||
|
||||
def terminate(self):
|
||||
pass
|
||||
|
||||
|
||||
class MockConnection:
|
||||
@staticmethod
|
||||
def wait(sentinels: List[int]):
|
||||
return sentinels
|
||||
Reference in New Issue
Block a user