2017-02-28 07:24:53 +00:00
|
|
|
# MIT licensed
|
2020-06-14 05:55:51 +00:00
|
|
|
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
2017-02-28 07:24:53 +00:00
|
|
|
|
2015-11-05 15:23:21 +00:00
|
|
|
import os
|
2018-05-04 03:46:40 +00:00
|
|
|
import re
|
2015-11-05 15:23:21 +00:00
|
|
|
import pytest
|
2017-07-04 09:04:29 +00:00
|
|
|
pytestmark = [pytest.mark.asyncio,
|
2019-10-15 09:27:34 +00:00
|
|
|
pytest.mark.needs_net,
|
2017-07-04 09:04:29 +00:00
|
|
|
pytest.mark.skipif("NVCHECKER_GITHUB_TOKEN" not in os.environ,
|
|
|
|
reason="requires NVCHECKER_GITHUB_TOKEN, or it fails too much")]
|
2015-11-05 03:25:57 +00:00
|
|
|
|
2017-07-04 09:04:29 +00:00
|
|
|
async def test_github(get_version):
|
|
|
|
assert await get_version("example", {"github": "harry-sanabria/ReleaseTestRepo"}) == "20140122.012101"
|
2015-11-05 03:25:57 +00:00
|
|
|
|
2018-02-07 10:54:09 +00:00
|
|
|
async def test_github_default_not_master(get_version):
|
2018-02-07 13:42:10 +00:00
|
|
|
assert await get_version("example", {"github": "MariaDB/server"}) is not None
|
2018-02-07 10:54:09 +00:00
|
|
|
|
2017-07-04 09:04:29 +00:00
|
|
|
async def test_github_latest_release(get_version):
|
|
|
|
assert await get_version("example", {"github": "harry-sanabria/ReleaseTestRepo", "use_latest_release": 1}) == "release3"
|
2015-11-05 03:25:57 +00:00
|
|
|
|
2017-07-04 09:04:29 +00:00
|
|
|
async def test_github_max_tag(get_version):
|
|
|
|
assert await get_version("example", {"github": "harry-sanabria/ReleaseTestRepo", "use_max_tag": 1}) == "second_release"
|
2015-11-05 03:25:57 +00:00
|
|
|
|
2017-07-04 09:04:29 +00:00
|
|
|
async def test_github_max_tag_with_ignored_tags(get_version):
|
|
|
|
assert await get_version("example", {"github": "harry-sanabria/ReleaseTestRepo", "use_max_tag": 1, "ignored_tags": "second_release release3"}) == "first_release"
|
2018-05-04 03:46:40 +00:00
|
|
|
|
2019-03-06 13:51:04 +00:00
|
|
|
async def test_github_max_tag_with_ignored(get_version):
|
|
|
|
assert await get_version("example", {"github": "harry-sanabria/ReleaseTestRepo", "use_max_tag": 1, "ignored": "second_release release3"}) == "first_release"
|
|
|
|
|
2019-01-28 08:53:42 +00:00
|
|
|
async def test_github_with_path(get_version):
|
|
|
|
assert await get_version("example", {"github": "petronny/ReleaseTestRepo", "path": "test_directory"}) == "20140122.012101"
|
|
|
|
|
|
|
|
async def test_github_with_path_and_branch(get_version):
|
|
|
|
assert await get_version("example", {"github": "petronny/ReleaseTestRepo", "branch": "test", "path": "test_directory/test_directory"}) == "20190128.113201"
|
|
|
|
|
2019-03-06 13:51:04 +00:00
|
|
|
async def test_github_max_tag_with_include_old(get_version):
|
2018-05-04 03:46:40 +00:00
|
|
|
version = await get_version("example", {
|
|
|
|
"github": "EFForg/https-everywhere",
|
|
|
|
"use_max_tag": 1,
|
2019-03-06 14:45:23 +00:00
|
|
|
"include_tags_pattern": r"^chrome-\d",
|
2018-05-04 03:46:40 +00:00
|
|
|
})
|
2019-03-06 14:45:23 +00:00
|
|
|
assert re.match(r'chrome-[\d.]+', version)
|
2019-03-06 13:51:04 +00:00
|
|
|
|
|
|
|
async def test_github_max_tag_with_include(get_version):
|
|
|
|
version = await get_version("example", {
|
|
|
|
"github": "EFForg/https-everywhere",
|
|
|
|
"use_max_tag": 1,
|
2019-03-06 14:37:18 +00:00
|
|
|
"include_regex": r"chrome-\d.*",
|
2019-03-06 13:51:04 +00:00
|
|
|
})
|
2019-03-06 14:37:18 +00:00
|
|
|
assert re.match(r'chrome-[\d.]+', version)
|
2020-06-14 05:55:51 +00:00
|
|
|
|
|
|
|
async def test_github_latest_tag(get_version):
|
|
|
|
assert await get_version("example", {"github": "harry-sanabria/ReleaseTestRepo", "use_latest_tag": 1}) == "release3"
|
|
|
|
|