port more tests

This commit is contained in:
lilydjwg 2020-08-18 16:45:20 +08:00
parent 7de923c1e1
commit 61a67a4a5b
9 changed files with 40 additions and 30 deletions

View File

@ -13,5 +13,5 @@ async def get_version(name, conf, *, cache, **kwargs):
if version != "dev-master"
}
if len(data):
return max(data, key=lambda version: versions[version]["time"])
if len(versions):
return max(versions, key=lambda version: versions[version]["time"])

View File

@ -1,8 +0,0 @@
# MIT licensed
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
async def test_gems(get_version):
assert await get_version("example", {"gems": None}) == "1.0.2"

View File

@ -1,8 +0,0 @@
# MIT licensed
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
async def test_hackage(get_version):
assert await get_version("sessions", {"hackage": None}) == "2008.7.18"

View File

@ -1,8 +0,0 @@
# MIT licensed
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
async def test_npm(get_version):
assert await get_version("example", {"npm": None}) == "0.0.0"

View File

@ -1,8 +1,10 @@
# MIT licensed
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
async def test_cpan(get_version):
assert await get_version("POE-Component-Server-HTTPServer", {"cpan": None}) == "0.9.2"
assert await get_version("POE-Component-Server-HTTPServer", {
"source": "cpan",
}) == "0.9.2"

10
tests/test_gems.py Normal file
View File

@ -0,0 +1,10 @@
# MIT licensed
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
async def test_gems(get_version):
assert await get_version("example", {
"source": "gems",
}) == "1.0.2"

10
tests/test_hackage.py Normal file
View File

@ -0,0 +1,10 @@
# MIT licensed
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
async def test_hackage(get_version):
assert await get_version("sessions", {
"source": "hackage",
}) == "2008.7.18"

10
tests/test_npm.py Normal file
View File

@ -0,0 +1,10 @@
# MIT licensed
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
async def test_npm(get_version):
assert await get_version("example", {
"source": "npm",
}) == "0.0.0"

View File

@ -1,8 +1,10 @@
# MIT licensed
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
async def test_packagist(get_version):
assert await get_version("butterfly/example-web-application", {"packagist": None}) == "1.2.0"
assert await get_version("butterfly/example-web-application", {
"source": "packagist",
}) == "1.2.0"