sample_archive = {'data': b'PK\x03\x04\x14\x00\x00\x00\x00\x00cq*Q\xcba\xb4c\x14\x00\x00\x00\x14\x00\x00\x00\x05\x00\x00\x00file1some c...ytest-0/test_single_deposit_slug_gener0/tmp7jg8xsy3', 'length': 128, 'md5sum': '9e8c110bb111a333f165f8a95d534d8b', ...}
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f6b16421c18>
caplog = <_pytest.logging.LogCaptureFixture object at 0x7f6b16421668>
tmp_path = '/tmp/pytest-of-jenkins/pytest-0/test_single_deposit_slug_gener0'
client_mock = <MagicMock id='140097911187160'>
def test_single_deposit_slug_generation(
sample_archive, mocker, caplog, tmp_path, client_mock
):
""" from:
https://docs.softwareheritage.org/devel/swh-deposit/getting-started.html#single-deposit
""" # noqa
slug = "my-slug"
collection = "my-collection"
metadata_path = os.path.join(tmp_path, "metadata.xml")
mocker.patch(
"swh.deposit.cli.client.tempfile.TemporaryDirectory",
> return_value=contextlib.nullcontext(str(tmp_path)),
)
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/cli/test_client.py:324:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/pytest_mock/plugin.py:341: in __call__
**kwargs
.tox/py3/lib/python3.7/site-packages/pytest_mock/plugin.py:182: in _start_patch
mocked = p.start() # type: unittest.mock.MagicMock
/usr/lib/python3.7/unittest/mock.py:1399: in start
result = self.__enter__()
/usr/lib/python3.7/unittest/mock.py:1252: in __enter__
self.target = self.getter()
/usr/lib/python3.7/unittest/mock.py:1422: in <lambda>
getter = lambda: _importer(target)
/usr/lib/python3.7/unittest/mock.py:1109: in _importer
thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
thing = <module 'swh.deposit.cli.client' from '/var/lib/jenkins/workspace/DDEP/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/deposit/cli/client.py'>
comp = 'tempfile', import_path = 'swh.deposit.cli.client.tempfile'
def _dot_lookup(thing, comp, import_path):
try:
return getattr(thing, comp)
except AttributeError:
> __import__(import_path)
E ModuleNotFoundError: No module named 'swh.deposit.cli.client.tempfile'; 'swh.deposit.cli.client' is not a package
/usr/lib/python3.7/unittest/mock.py:1098: ModuleNotFoundError
TEST RESULT
TEST RESULT
- Run At
- Sep 10 2020, 4:11 PM