• Kirill Smelkov's avatar
    gpython: tests: test_pymain: Fix -i on PyPy3 · 6ca43f2d
    Kirill Smelkov authored
    On py3 'ps1' and b'ps1' are different keys and it was failing on PyPy3 as follows:
    
                # -i after stdin (also tests interactive mode as -i forces interactive even on non-tty)
                d = {
                    b'hellopy': b(hellopy),
                    b'ps1':     b'' # cpython emits prompt to stderr
                }
                if is_pypy and not is_gpython:
                    d['ps1'] = b'>>>> ' # native pypy emits prompt to stdout and >>>> instead of >>>
                _ = pyout(['-i'], stdin=b'import hello\n', cwd=testdata)
        >       assert _ == b"%(ps1)shello\nworld\n['']\n%(ps1)s"           % d
        E       assert b">>>> hello\...\n['']\n>>>> " == b"hello\nworld\n['']\n"
        E         At index 0 diff: b'>' != b'h'
        E         Full diff:
        E         - b"hello\nworld\n['']\n"
        E         + b">>>> hello\nworld\n['']\n>>>> "
        E         ?   +++++                    +++++
    
        gpython/gpython_test.py:200: AssertionError
    
    Fix it.
    Amends e205dbf6 (gpython: Implement -i (interactive inspect after program run) + promised interactive-mode tests)
    6ca43f2d
gpython_test.py 14 KB