2020-08-18 08:22:14 +00:00
|
|
|
# MIT licensed
|
|
|
|
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
|
|
|
|
2020-08-20 07:50:36 +00:00
|
|
|
from flaky import flaky
|
2020-08-18 08:22:14 +00:00
|
|
|
import pytest
|
|
|
|
pytestmark = [pytest.mark.asyncio,
|
|
|
|
pytest.mark.needs_net]
|
|
|
|
|
2020-08-20 07:50:36 +00:00
|
|
|
@flaky(max_runs=10)
|
2020-08-18 08:22:14 +00:00
|
|
|
async def test_gitea(get_version):
|
|
|
|
ver = await get_version("example", {
|
|
|
|
"source": "gitea",
|
|
|
|
"gitea": "gitea/tea"})
|
|
|
|
assert len(ver) == 8
|
|
|
|
assert ver.isdigit()
|
|
|
|
|
2020-08-20 07:50:36 +00:00
|
|
|
@flaky(max_runs=10)
|
2020-08-18 08:22:14 +00:00
|
|
|
async def test_gitea_max_tag(get_version):
|
|
|
|
assert await get_version("example", {
|
|
|
|
"source": "gitea",
|
|
|
|
"gitea": "gitea/tea",
|
|
|
|
"use_max_tag": True,
|
2020-09-17 05:20:38 +00:00
|
|
|
}) == "v0.4.1"
|
2020-08-18 08:22:14 +00:00
|
|
|
|
2020-08-20 07:50:36 +00:00
|
|
|
@flaky(max_runs=10)
|
2020-08-18 08:35:26 +00:00
|
|
|
async def test_gitea_max_tag_with_ignored(get_version):
|
2020-08-18 08:22:14 +00:00
|
|
|
assert await get_version("example", {
|
|
|
|
"source": "gitea",
|
|
|
|
"gitea": "gitea/tea",
|
|
|
|
"use_max_tag": True,
|
2020-09-17 05:20:38 +00:00
|
|
|
"ignored": "v0.4.0 v0.4.1",
|
2020-08-18 08:22:14 +00:00
|
|
|
}) == "v0.3.1"
|
|
|
|
|
2020-08-20 07:50:36 +00:00
|
|
|
@flaky(max_runs=10)
|
2020-08-18 08:22:14 +00:00
|
|
|
async def test_gitea_max_tag_with_include(get_version):
|
|
|
|
assert await get_version("example", {
|
|
|
|
"source": "gitea",
|
|
|
|
"gitea": "gitea/tea",
|
|
|
|
"use_max_tag": True,
|
|
|
|
"include_regex": r'v0\.3.*',
|
|
|
|
}) == "v0.3.1"
|