It's easy to reproduce this problem with master branch also. With some debug. I think it's due to the mock on urlopen doesn't take effective sometime (not sure why it does work sometime).
Successful##### time: 2018-03-22 03:10:23.251676Z tags: worker-3 test: os_xenapi.tests.plugins.test_glance.GlanceTestCase.test_download_ok_extract_failed time: 2018-03-22 03:10:23.260027Z successful: os_xenapi.tests.plugins.test_glance.GlanceTestCase.test_download_ok_extract_failed [ multipart Content-Type: text/plain;charset=utf8 stdout 90^M wjh: calling utils.extract_tarball wjh: finally error is 'fake_cmd' returned non-zero exit code: retcode=0, out='fake_out', stderr='fake_stderr'0^M ]
## failed#### test: os_xenapi.tests.plugins.test_glance.GlanceTestCase.test_download_ok_extract_failed time: 2018-03-22 03:07:50.162910Z failure: os_xenapi.tests.plugins.test_glance.GlanceTestCase.test_download_ok_extract_failed [ multipart Content-Type: text/plain;charset=utf8 stdout 1D^M error is <urlopen error None>0^M Content-Type: text/x-traceback;language=python,charset=utf8 traceback 215^M Traceback (most recent call last): File "/root/os-xenapi/.tox/py27/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched return func(*args, **keywargs) File "os_xenapi/tests/plugins/test_glance.py", line 126, in test_download_ok_extract_failed mock_extract_tarball.assert_called_once() File "/root/os-xenapi/.tox/py27/lib/python2.7/site-packages/mock/mock.py", line 915, in assert_called_once raise AssertionError(msg) AssertionError: Expected 'extract_tarball' to have been called once. Called 0 times. 0^M ]
It's easy to reproduce this problem with master branch also.
With some debug. I think it's due to the mock on urlopen doesn't take effective sometime (not sure why it does work sometime).
Successful##### tests.plugins. test_glance. GlanceTestCase. test_download_ ok_extract_ failed tests.plugins. test_glance. GlanceTestCase. test_download_ ok_extract_ failed [ multipart charset= utf8 tarball 'fake_stderr' 0^M
time: 2018-03-22 03:10:23.251676Z
tags: worker-3
test: os_xenapi.
time: 2018-03-22 03:10:23.260027Z
successful: os_xenapi.
Content-Type: text/plain;
stdout
90^M
wjh: calling utils.extract_
wjh: finally
error is 'fake_cmd' returned non-zero exit code: retcode=0, out='fake_out', stderr=
]
## failed#### tests.plugins. test_glance. GlanceTestCase. test_download_ ok_extract_ failed tests.plugins. test_glance. GlanceTestCase. test_download_ ok_extract_ failed [ multipart charset= utf8 traceback; language= python, charset= utf8 os-xenapi/ .tox/py27/ lib/python2. 7/site- packages/ mock/mock. py", line 1305, in patched tests/plugins/ test_glance. py", line 126, in test_download_ ok_extract_ failed extract_ tarball. assert_ called_ once() os-xenapi/ .tox/py27/ lib/python2. 7/site- packages/ mock/mock. py", line 915, in assert_called_once
test: os_xenapi.
time: 2018-03-22 03:07:50.162910Z
failure: os_xenapi.
Content-Type: text/plain;
stdout
1D^M
error is <urlopen error None>0^M
Content-Type: text/x-
traceback
215^M
Traceback (most recent call last):
File "/root/
return func(*args, **keywargs)
File "os_xenapi/
mock_
File "/root/
raise AssertionError(msg)
AssertionError: Expected 'extract_tarball' to have been called once. Called 0 times.
0^M
]