nvchecker/tests
Chih-Hsuan Yen 61bc0c5562
Fix test_pacman in some scenarios
For example, on reproducible.archlinux.org, apparently pacman databases
are not synced before building synced before building packages, and thus
packages cannot be found. From https://reproducible.archlinux.org/api/v0/builds/110565/log,

=================================== FAILURES ===================================
_________________________________ test_pacman __________________________________

get_version = <function get_version.<locals>.__call__ at 0x7f2fa5ed1310>

    async def test_pacman(get_version):
>       assert await get_version("ipw2100-fw", {
            "source": "pacman",
        }) == "1.3-10"

tests/test_pacman.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/conftest.py:46: in __call__
    newvers = await run(entries)
tests/conftest.py:40: in run
    return await main.run(result_coro, runner_coro)
nvchecker/__main__.py:92: in run
    return await result_fu
nvchecker/core.py:361: in process_result
    r1 = _process_result(r)
nvchecker/core.py:322: in _process_result
    logger.error(version.msg, **kw)
/usr/lib/python3.9/site-packages/structlog/_log_levels.py:118: in meth
    return self._proxy_to_logger(name, event, **kw)
/usr/lib/python3.9/site-packages/structlog/_base.py:198: in _proxy_to_logger
    args, kw = self._process_event(method_name, event, event_kw)
/usr/lib/python3.9/site-packages/structlog/_base.py:155: in _process_event
    event_dict = proc(self._logger, method_name, event_dict)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

logger = <PrintLogger(file=<_io.TextIOWrapper name="<_io.FileIO name=6 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>)>
method_name = 'error'
event_dict = {'cmd': "LANG=C pacman -Si ipw2100-fw | grep -F Version | awk '{print $3}' | head -n 1", 'error': "warning: database f...r: package 'ipw2100-fw' was not found", 'event': 'command exited without output', 'logger_name': 'nvchecker.core', ...}

    def proc(logger, method_name, event_dict):
      if method_name in ('warning', 'error'):
        if 'exc_info' in event_dict:
          raise event_dict['exc_info']
        if not event_dict['event'].startswith(('rate limited', 'no-result')):
>         raise RuntimeError(event_dict['event'])
E         RuntimeError: command exited without output

tests/conftest.py:85: RuntimeError
----------------------------- Captured stdout call -----------------------------
running cmd
__________________________ test_pacman_strip_release ___________________________

get_version = <function get_version.<locals>.__call__ at 0x7f2fa5ed1310>

    async def test_pacman_strip_release(get_version):
>       assert await get_version("ipw2100-fw", {
            "source": "pacman",
            "strip_release": 1,
        }) == "1.3"

tests/test_pacman.py:16:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/conftest.py:46: in __call__
    newvers = await run(entries)
tests/conftest.py:40: in run
    return await main.run(result_coro, runner_coro)
nvchecker/__main__.py:92: in run
    return await result_fu
nvchecker/core.py:361: in process_result
    r1 = _process_result(r)
nvchecker/core.py:322: in _process_result
    logger.error(version.msg, **kw)
/usr/lib/python3.9/site-packages/structlog/_log_levels.py:118: in meth
    return self._proxy_to_logger(name, event, **kw)
/usr/lib/python3.9/site-packages/structlog/_base.py:198: in _proxy_to_logger
    args, kw = self._process_event(method_name, event, event_kw)
/usr/lib/python3.9/site-packages/structlog/_base.py:155: in _process_event
    event_dict = proc(self._logger, method_name, event_dict)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

logger = <PrintLogger(file=<_io.TextIOWrapper name="<_io.FileIO name=6 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>)>
method_name = 'error'
event_dict = {'cmd': "LANG=C pacman -Si ipw2100-fw | grep -F Version | awk '{print $3}' | head -n 1", 'error': "warning: database f...r: package 'ipw2100-fw' was not found", 'event': 'command exited without output', 'logger_name': 'nvchecker.core', ...}

    def proc(logger, method_name, event_dict):
      if method_name in ('warning', 'error'):
        if 'exc_info' in event_dict:
          raise event_dict['exc_info']
        if not event_dict['event'].startswith(('rate limited', 'no-result')):
>         raise RuntimeError(event_dict['event'])
E         RuntimeError: command exited without output

tests/conftest.py:85: RuntimeError
----------------------------- Captured stdout call -----------------------------
running cmd
2021-06-03 12:11:41 +08:00
..
__init__.py version 2: MVP 2020-08-11 17:43:03 +08:00
conftest.py setup httpclient from configuration options 2020-09-28 15:09:51 +08:00
test_alpm.py tests/test_alpm: add --nosign and remove an unused import 2020-11-10 23:27:09 +08:00
test_android_sdk.py Update tests 2021-05-06 12:44:55 +08:00
test_anitya.py Update tests 2021-05-06 12:44:55 +08:00
test_apt.py Fix tests 2021-02-13 23:30:48 +08:00
test_archpkg.py tests/test_archpkg: use "dbus" to test "provided" 2020-10-23 17:06:44 +08:00
test_aur.py start porting tests to new version 2020-08-17 15:11:14 +08:00
test_bitbucket.py remove ignored_tags from vcs and bitbucket sources 2020-08-18 16:35:26 +08:00
test_cache.py dash doesn't have $RANDOM 2020-08-20 15:31:00 +08:00
test_cmd.py start porting tests to new version 2020-08-17 15:11:14 +08:00
test_container.py Add container source plugin 2020-10-07 19:17:48 +08:00
test_cpan.py port more tests 2020-08-18 16:45:20 +08:00
test_cratesio.py port more tests 2020-08-17 16:31:59 +08:00
test_debianpkg.py tests/test_debianpkg: update 2020-09-03 16:30:32 +08:00
test_gems.py port more tests 2020-08-18 16:45:20 +08:00
test_git.py git source: support fetching commit hash on a branch 2020-12-24 22:01:22 +08:00
test_gitea.py test_gitea: remove some cases that go out of date too frequently 2020-09-28 16:12:22 +08:00
test_github.py final tweak of keyfile 2020-08-20 15:18:43 +08:00
test_gitlab.py Update tests 2021-05-06 12:44:55 +08:00
test_hackage.py hackage is flaky 2020-08-20 17:07:16 +08:00
test_httpheader.py tests: add needs_net marker to httpheader test 2021-03-20 04:20:00 +00:00
test_manual.py port more tests 2020-08-17 16:31:59 +08:00
test_npm.py port more tests 2020-08-18 16:45:20 +08:00
test_packagist.py port more tests 2020-08-18 16:45:20 +08:00
test_pacman.py Fix test_pacman in some scenarios 2021-06-03 12:11:41 +08:00
test_pagure.py Add support for Pagure 2020-09-01 18:11:57 +08:00
test_pypi.py port more tests 2020-08-17 16:21:02 +08:00
test_regex.py port more tests 2020-08-17 16:21:02 +08:00
test_repology.py repology: add support for subrepo 2020-10-30 06:06:15 +01:00
test_sortversion.py Use pytest for sortversion tests 2021-02-21 15:24:01 +08:00
test_sparkle.py port more tests 2020-08-17 16:21:02 +08:00
test_substitute.py Allow empty to_pattern 2020-10-02 04:39:57 +08:00
test_ubuntupkg.py port more tests 2020-08-17 16:31:59 +08:00