Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test(status=False):
if os.environ.get('TRAVIS') == 'true':
return
if os.environ.get('APPVEYOR') == 'True':
return
random.seed(SEED)
deque = dc.Deque(range(SIZE))
processes = []
for count in range(8):
process = mp.Process(target=stress, args=(SEED + count, deque))
process.start()
processes.append(process)
for value in it.count():
time.sleep(1)
if status:
print('\r', value, 's', len(deque), 'items', ' ' * 20, end='')
if all(not process.is_alive() for process in processes):
break
def test_init():
directory = '/tmp/diskcache/deque'
sequence = list('abcde')
deque = dc.Deque(sequence, None)
assert deque == sequence
rmdir(deque.directory)
del deque
rmdir(directory)
deque = dc.Deque(sequence, directory)
assert deque.directory == directory
assert deque == sequence
other = dc.Deque(directory=directory)
assert other == deque
def test_init():
directory = '/tmp/diskcache/deque'
sequence = list('abcde')
deque = dc.Deque(sequence, None)
assert deque == sequence
rmdir(deque.directory)
del deque
rmdir(directory)
deque = dc.Deque(sequence, directory)
assert deque.directory == directory
assert deque == sequence
other = dc.Deque(directory=directory)
assert other == deque
del deque
del other
rmdir(directory)
directory = '/tmp/diskcache/deque'
sequence = list('abcde')
deque = dc.Deque(sequence, None)
assert deque == sequence
rmdir(deque.directory)
del deque
rmdir(directory)
deque = dc.Deque(sequence, directory)
assert deque.directory == directory
assert deque == sequence
other = dc.Deque(directory=directory)
assert other == deque
del deque
del other
rmdir(directory)
def deque():
deque = dc.Deque()
yield deque
rmdir(deque.directory)
def test_repr():
directory = '/tmp/diskcache/deque'
deque = dc.Deque(directory=directory)
assert repr(deque) == 'Deque(directory=%r)' % directory