diff --git a/nvchecker_source/packagist.py b/nvchecker_source/packagist.py index 77e019b..c7f39cd 100644 --- a/nvchecker_source/packagist.py +++ b/nvchecker_source/packagist.py @@ -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"]) diff --git a/tests-old/test_gems.py b/tests-old/test_gems.py deleted file mode 100644 index a249d04..0000000 --- a/tests-old/test_gems.py +++ /dev/null @@ -1,8 +0,0 @@ -# MIT licensed -# Copyright (c) 2013-2017 lilydjwg , 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" diff --git a/tests-old/test_hackage.py b/tests-old/test_hackage.py deleted file mode 100644 index 74bd87a..0000000 --- a/tests-old/test_hackage.py +++ /dev/null @@ -1,8 +0,0 @@ -# MIT licensed -# Copyright (c) 2013-2017 lilydjwg , 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" diff --git a/tests-old/test_npm.py b/tests-old/test_npm.py deleted file mode 100644 index ef9f5ac..0000000 --- a/tests-old/test_npm.py +++ /dev/null @@ -1,8 +0,0 @@ -# MIT licensed -# Copyright (c) 2013-2017 lilydjwg , 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" diff --git a/tests-old/test_cpan.py b/tests/test_cpan.py similarity index 62% rename from tests-old/test_cpan.py rename to tests/test_cpan.py index a35092e..ed1e488 100644 --- a/tests-old/test_cpan.py +++ b/tests/test_cpan.py @@ -1,8 +1,10 @@ # MIT licensed -# Copyright (c) 2013-2017 lilydjwg , et al. +# Copyright (c) 2013-2020 lilydjwg , 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" diff --git a/tests/test_gems.py b/tests/test_gems.py new file mode 100644 index 0000000..f51f179 --- /dev/null +++ b/tests/test_gems.py @@ -0,0 +1,10 @@ +# MIT licensed +# Copyright (c) 2013-2020 lilydjwg , 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" diff --git a/tests/test_hackage.py b/tests/test_hackage.py new file mode 100644 index 0000000..4b3a37e --- /dev/null +++ b/tests/test_hackage.py @@ -0,0 +1,10 @@ +# MIT licensed +# Copyright (c) 2013-2020 lilydjwg , 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" diff --git a/tests/test_npm.py b/tests/test_npm.py new file mode 100644 index 0000000..2e11385 --- /dev/null +++ b/tests/test_npm.py @@ -0,0 +1,10 @@ +# MIT licensed +# Copyright (c) 2013-2020 lilydjwg , 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" diff --git a/tests-old/test_packagist.py b/tests/test_packagist.py similarity index 62% rename from tests-old/test_packagist.py rename to tests/test_packagist.py index df68fe0..71f005e 100644 --- a/tests-old/test_packagist.py +++ b/tests/test_packagist.py @@ -1,8 +1,10 @@ # MIT licensed -# Copyright (c) 2013-2017 lilydjwg , et al. +# Copyright (c) 2013-2020 lilydjwg , 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"