swh_config = '/tmp/pytest-of-jenkins/pytest-0/test_nixguix_url_not_found0/loader.yml'
requests_mock_datadir = <requests_mock.mocker.Mocker object at 0x7fdfe209ca20>
def test_nixguix_url_not_found(swh_config, requests_mock_datadir):
"""When failing to read from the url, the visit is marked as not_found.
"""
unknown_sources_url = "https://non-existing-url"
loader = NixGuixLoader(unknown_sources_url)
# during the retrieval step
load_status = loader.load()
assert load_status == {"status": "failed"}
assert_last_visit_matches(
> loader.storage, sources_url, status="not_found", type="nixguix", snapshot=None
)
.tox/py3/lib/python3.7/site-packages/swh/loader/package/nixguix/tests/test_nixguix.py:121:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
storage = <swh.storage.postgresql.storage.Storage object at 0x7fdfe2075e80>
url = 'https://nix-community.github.io/nixpkgs-swh/sources.json'
status = 'not_found', type = 'nixguix', snapshot = None
def assert_last_visit_matches(
storage,
url: str,
status: str,
type: Optional[str] = None,
snapshot: Optional[bytes] = None,
) -> OriginVisitStatus:
"""This retrieves the last visit and visit_status which are expected to exist.
This also checks that the {visit|visit_status} have their respective properties
correctly set.
This returns the last visit_status for that given origin.
Args:
url: Origin url
status: Check that the visit status has the given status
type: Check that the returned visit has the given type
snapshot: Check that the visit status points to the given snapshot
Raises:
AssertionError in case visit or visit status is not found, or any of the type,
status and snapshot mismatch
Returns:
the visit status for further check during the remaining part of the test.
"""
visit_status = origin_get_latest_visit_status(storage, url)
> assert visit_status is not None, f"Origin {url} has no visits"
E AssertionError: Origin https://nix-community.github.io/nixpkgs-swh/sources.json has no visits
E assert None is not None
.tox/py3/lib/python3.7/site-packages/swh/loader/tests/__init__.py:48: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 11 2021, 9:06 AM