caplog = <_pytest.logging.LogCaptureFixture object at 0x7f94ac594c88>
tmp_path = PosixPath('/tmp/pytest-of-jenkins/pytest-0/test_clone_with_timeout_timeou0')
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f94ac4ce7f0>
def test_clone_with_timeout_timeout(caplog, tmp_path, monkeypatch):
log = logging.getLogger("test_clone_with_timeout")
def clone_timeout(source, dest):
time.sleep(60)
monkeypatch.setattr(hglib, "clone", clone_timeout)
with pytest.raises(CloneTimeoutError):
HgBundle20Loader.clone_with_timeout(
> log, "https://www.mercurial-scm.org/repo/hello", tmp_path, 1
)
.tox/py3/lib/python3.7/site-packages/swh/loader/mercurial/tests/test_loader.py:335:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
log = <Logger test_clone_with_timeout (WARNING)>
origin = 'https://www.mercurial-scm.org/repo/hello'
destination = PosixPath('/tmp/pytest-of-jenkins/pytest-0/test_clone_with_timeout_timeou0')
timeout = 1
@staticmethod
def clone_with_timeout(log, origin, destination, timeout):
queue = billiard.Queue()
start = time.monotonic()
def do_clone(queue, origin, destination):
try:
result = hglib.clone(source=origin, dest=destination, noupdate=True)
except CommandError as e:
# the queued object need an empty constructor to be deserialized later
queue.put(CommandErrorWrapper(e.err))
except BaseException as e:
queue.put(e)
else:
queue.put(result)
process = billiard.Process(target=do_clone, args=(queue, origin, destination))
process.start()
while True:
try:
result = queue.get(timeout=0.1)
break
except Empty:
duration = time.monotonic() - start
if timeout and duration > timeout:
log.warning(
"Timeout cloning `%s` within %s seconds", origin, timeout
)
process.terminate()
process.join()
raise CloneTimeoutError(origin, timeout)
continue
process.join()
if isinstance(result, Exception):
> raise result from None
E TypeError: clone_timeout() got an unexpected keyword argument 'noupdate'
.tox/py3/lib/python3.7/site-packages/swh/loader/mercurial/loader.py:228: TypeError
TEST RESULT
TEST RESULT
- Run At
- Feb 25 2021, 12:01 PM