Commit Graph

12 Commits

Author SHA1 Message Date
Chih-Hsuan Yen
4ca61ba11a tests: fix for pytest-asyncio 0.23 2023-12-09 20:38:00 +08:00
Daniel Peukert
5a6fee2817
fix pacman test 2023-10-18 01:59:43 +02:00
Chih-Hsuan Yen
3d3d8c6136 Fix test_{archpkg,pacman}
Apparently the ipw2100-fw package is dropped. I switched to another
package that is rarely updated.
2022-10-29 14:21:02 +08:00
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
lilydjwg
4887ec66d9 port more tests 2020-08-17 16:21:02 +08:00
lilydjwg
10f6b1561e start porting tests to new version 2020-08-17 15:11:14 +08:00
Chih-Hsuan Yen
7055ad555e
Update for upcoming ipw2100-fw 1.3-10
It's rebuilt during the last [core] mass rebuilds [1].

[1] https://lists.archlinux.org/pipermail/arch-dev-public/2019-November/029721.html
2019-11-18 16:58:44 +08:00
lilydjwg
d0ee359209 update tests and bump version to dev 2018-11-19 15:16:29 +08:00
Felix Yan
84df2716b5 AsyncIO rewrite 2017-07-06 12:24:45 +08:00
Felix Yan
af982c19dd
Update archpkg and pacman test cases to match new package version 2017-06-27 01:32:48 +08:00
lilydjwg
8e2be647e0 add license declaration to each file 2017-02-28 15:27:24 +08:00
Felix Yan
5bde44a3c2 Add testcases for pacman 2015-11-05 20:47:46 +08:00