2019-10-29 15:40:24 +00:00
|
|
|
# MIT licensed
|
2020-08-17 08:31:59 +00:00
|
|
|
# Copyright (c) 2019-2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
2019-10-29 15:40:24 +00:00
|
|
|
|
2023-08-26 02:17:40 +00:00
|
|
|
from flaky import flaky
|
2019-10-29 15:40:24 +00:00
|
|
|
import pytest
|
2023-12-09 11:17:31 +00:00
|
|
|
pytestmark = [pytest.mark.asyncio(scope="session"),
|
2019-10-29 15:40:24 +00:00
|
|
|
pytest.mark.needs_net]
|
|
|
|
|
2023-08-26 02:17:40 +00:00
|
|
|
@flaky(max_runs=10)
|
2019-10-29 15:40:24 +00:00
|
|
|
async def test_repology(get_version):
|
2020-08-17 08:31:59 +00:00
|
|
|
assert await get_version("ssed", {
|
|
|
|
"source": "repology",
|
|
|
|
"repo": "aur",
|
|
|
|
}) == "3.62"
|
2019-10-29 15:40:24 +00:00
|
|
|
|
2023-08-26 02:17:40 +00:00
|
|
|
@flaky(max_runs=10)
|
2020-10-29 14:14:29 +00:00
|
|
|
async def test_repology_subrepo(get_version):
|
|
|
|
assert await get_version("asciiquarium", {
|
|
|
|
"source": "repology",
|
|
|
|
"repo": "fedora_32",
|
|
|
|
"subrepo": "release"
|
|
|
|
}) == "1.1"
|
|
|
|
|
|
|
|
async def test_repology_bad_subrepo(get_version):
|
|
|
|
try:
|
|
|
|
assert await get_version("asciiquarium", {
|
|
|
|
"source": "repology",
|
|
|
|
"repo": "fedora_32",
|
|
|
|
"subrepo": "badsubrepo"
|
|
|
|
}) is None
|
|
|
|
except RuntimeError as e:
|
|
|
|
assert "package is not found in subrepo" in str(e)
|
|
|
|
|
2019-10-29 15:40:24 +00:00
|
|
|
async def test_repology_no_repo(get_version):
|
|
|
|
try:
|
2020-08-17 08:31:59 +00:00
|
|
|
assert await get_version("ssed", {
|
|
|
|
"source": "repology",
|
|
|
|
}) is None
|
2019-10-29 15:40:24 +00:00
|
|
|
except RuntimeError as e:
|
|
|
|
assert "repo field is required" in str(e)
|