Skip to content

metakernel/tests/test_replwrap.py::REPLWrapTestCase::test_bash fails because of control codes in man(1) output #266

Open
@mgorny

Description

This test fals on Gentoo, apparently because man(1) is outputting control codes between characters.

============================================================== FAILURES ===============================================================
_____________________________________________________ REPLWrapTestCase.test_bash ______________________________________________________

self = <metakernel.tests.test_replwrap.REPLWrapTestCase testMethod=test_bash>

    def test_bash(self):
        bash = replwrap.bash()
        res = bash.run_command("time")
        assert 'real' in res, res
    
        # PAGER should be set to cat, otherwise man hangs
        res = bash.run_command('man sleep', timeout=2)
>       assert 'SLEEP' in res, res
E       AssertionError: SLEEP(1)                         User Commands                        SLEEP(1)^M
E         ^M
E         NAME^M
E                sleep - delay for a specified amount of time^M
E         ^M
E         SYNOPSIS^M
E                sleep NUMBER[SUFFIX]...^M
E                sleep OPTION^M
E         ^M
E         DESCRIPTION^M
E                Pause for NUMBER seconds.  SUFFIX may be 's' for seconds (the default),^M
E                'm'  for minutes, 'h' for hours or 'd' for days.  NUMBER need not be an^M
E                integer.  Given two or more arguments, pause for  the  amount  of  time^M
E                specified by the sum of their values.^M
E         ^M
E                --help display this help and exit^M
E         ^M
E                --version^M
E                       output version information and exit^M
E         ^M
E         AUTHOR^M
E                Written by Jim Meyering and Paul Eggert.^M
E         ^M
E         REPORTING BUGS^M
E                GNU coreutils online help: <https://www.gnu.org/software/coreutils/>^M
E                Report any translation bugs to <https://translationproject.org/team/>^M
E         ^M
E         SEE ALSO^M
E                sleep(3)^M
E         ^M
E                Full documentation <https://www.gnu.org/software/coreutils/sleep>^M
E                or available locally via: info '(coreutils) sleep invocation'^M
E         ^M
E                Packaged by Gentoo (9.3-r3 (p0))^M
E                Copyright (C) 2023 Free Software Foundation, Inc.^M
E                License  GPLv3+:  GNU  GPL  version  3  or  later  <https://gnu.org/li-^M
E                censes/gpl.html>.^M
E                This is free software: you are free to change and redistribute it.^M
E                There is NO WARRANTY, to the extent permitted by law.^M
E         ^M
E         GNU coreutils 9.3                 April 2023                          SLEEP(1)^M
E         
E       assert 'SLEEP' in "_\x08S_\x08L_\x08E_\x08E_\x08P(1)                         User Commands                        _\x08S_\x08L_\x08E_\x08E_\x08P(1)\r\n\r\nN\x08NA\x08AM\x08ME\x08E\r\n       sleep - delay for a specified amount of time\r\n\r\nS\x08SY\x08YN\x08NO\x08OP\x08PS\x08SI\x08IS\x08S\r\n       s\x08sl\x08le\x08ee\x08ep\x08p _\x08N_\x08U_\x08M_\x08B_\x08E_\x08R[_\x08S_\x08U_\x08F_\x08F_\x08I_\x08X]...\r\n       s\x08sl\x08le\x08ee\x08ep\x08p _\x08O_\x08P_\x08T_\x08I_\x08O_\x08N\r\n\r\nD\x08DE\x08ES\x08SC\x08CR\x08RI\x08IP\x08PT\x08TI\x08IO\x08ON\x08N\r\n       Pause for NUMBER seconds.  SUFFIX may be 's' for seconds (the default),\r\n       'm'  for minutes, 'h' for hours or 'd' for days.  NUMBER need not be an\r\n       integer.  Given two or more arguments, pause for  the  amount  of  time\r\n       specified by the sum of their values.\r\n\r\n       -\x08--\x08-h\x08he\x08el\x08lp\x08p display this help and exit\r\n\r\n       -\x08--\x08-v\x08ve\x08er\x08rs\x08si\x08io\x08on\x08n\r\n              output version information and exit\r\n\r\nA\x08AU\x08UT\x08TH\x08HO\x08OR\x08R\r\n       Written by Jim Meyering and Paul Eggert.\r\n\r\nR\x08RE\x08EP\x08PO\x08OR\x08RT\x08TI\x08IN\x08NG\x08G B\x08BU\x08UG\x08GS\x08S\r\n       GNU coreutils online help: <https://www.gnu.org/software/coreutils/>\r\n       Report any translation bugs to <https://translationproject.org/team/>\r\n\r\nS\x08SE\x08EE\x08E A\x08AL\x08LS\x08SO\x08O\r\n       s\x08sl\x08le\x08ee\x08ep\x08p(3)\r\n\r\n       Full documentation <https://www.gnu.org/software/coreutils/sleep>\r\n       or available locally via: info '(coreutils) sleep invocation'\r\n\r\n       Packaged by Gentoo (9.3-r3 (p0))\r\n       Copyright (C) 2023 Free Software Foundation, Inc.\r\n       License  GPLv3+:  GNU  GPL  version  3  or  later  <https://gnu.org/li-\r\n       censes/gpl.html>.\r\n       This is free software: you are free to change and redistribute it.\r\n       There is NO WARRANTY, to the extent permitted by law.\r\n\r\nGNU coreutils 9.3                 April 2023                          _\x08S_\x08L_\x08E_\x08E_\x08P(1)\r\n"

bash       = <metakernel.replwrap.REPLWrapper object at 0x7fb6d0586b60>
res        = ('_\x08S_\x08L_\x08E_\x08E_\x08P(1)                         User '
 'Commands                        _\x08S_\x08L_\x08E_\x08E_\x08P(1)\r\n'
 '\r\n'
 'N\x08NA\x08AM\x08ME\x08E\r\n'
 '       sleep - delay for a specified amount of time\r\n'
 '\r\n'
 'S\x08SY\x08YN\x08NO\x08OP\x08PS\x08SI\x08IS\x08S\r\n'
 '       s\x08sl\x08le\x08ee\x08ep\x08p '
 '_\x08N_\x08U_\x08M_\x08B_\x08E_\x08R[_\x08S_\x08U_\x08F_\x08F_\x08I_\x08X]...\r\n'
 '       s\x08sl\x08le\x08ee\x08ep\x08p '
 '_\x08O_\x08P_\x08T_\x08I_\x08O_\x08N\r\n'
 '\r\n'
 'D\x08DE\x08ES\x08SC\x08CR\x08RI\x08IP\x08PT\x08TI\x08IO\x08ON\x08N\r\n'
 "       Pause for NUMBER seconds.  SUFFIX may be 's' for seconds (the "
 'default),\r\n'
 "       'm'  for minutes, 'h' for hours or 'd' for days.  NUMBER need not be "
 'an\r\n'
 '       integer.  Given two or more arguments, pause for  the  amount  of  '
 'time\r\n'
 '       specified by the sum of their values.\r\n'
 '\r\n'
 '       -\x08--\x08-h\x08he\x08el\x08lp\x08p display this help and exit\r\n'
 '\r\n'
 '       -\x08--\x08-v\x08ve\x08er\x08rs\x08si\x08io\x08on\x08n\r\n'
 '              output version information and exit\r\n'
 '\r\n'
 'A\x08AU\x08UT\x08TH\x08HO\x08OR\x08R\r\n'
 '       Written by Jim Meyering and Paul Eggert.\r\n'
 '\r\n'
 'R\x08RE\x08EP\x08PO\x08OR\x08RT\x08TI\x08IN\x08NG\x08G '
 'B\x08BU\x08UG\x08GS\x08S\r\n'
 '       GNU coreutils online help: '
 '<https://www.gnu.org/software/coreutils/>\r\n'
 '       Report any translation bugs to '
 '<https://translationproject.org/team/>\r\n'
 '\r\n'
 'S\x08SE\x08EE\x08E A\x08AL\x08LS\x08SO\x08O\r\n'
 '       s\x08sl\x08le\x08ee\x08ep\x08p(3)\r\n'
 '\r\n'
 '       Full documentation <https://www.gnu.org/software/coreutils/sleep>\r\n'
 "       or available locally via: info '(coreutils) sleep invocation'\r\n"
 '\r\n'
 '       Packaged by Gentoo (9.3-r3 (p0))\r\n'
 '       Copyright (C) 2023 Free Software Foundation, Inc.\r\n'
 '       License  GPLv3+:  GNU  GPL  version  3  or  later  '
 '<https://gnu.org/li-\r\n'
 '       censes/gpl.html>.\r\n'
 '       This is free software: you are free to change and redistribute it.\r\n'
 '       There is NO WARRANTY, to the extent permitted by law.\r\n'
 '\r\n'
 'GNU coreutils 9.3                 April 2023                          '
 '_\x08S_\x08L_\x08E_\x08E_\x08P(1)\r\n')
self       = <metakernel.tests.test_replwrap.REPLWrapTestCase testMethod=test_bash>

/tmp/portage/dev-python/metakernel-0.29.5/work/metakernel-0.29.5/metakernel/tests/test_replwrap.py:31: AssertionError

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions