Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests are failing on a clean fork #182

Open
royby-cyberark opened this issue May 24, 2022 · 1 comment
Open

Tests are failing on a clean fork #182

royby-cyberark opened this issue May 24, 2022 · 1 comment

Comments

@royby-cyberark
Copy link

Hi,
I would like to start contributing to PyInquirer and I went through the steps under the contribution section.
When running the tests most fail, with basically two errors:

  1. e.g.: FAILED tests/test_prompts_list.py::test_cycle_backwards - AttributeError: 'str' object has no attribute 'read_fd'.
    This seems to come from the use of PosixPipeInput in feed_app_with_input.
    Perhaps this is something that is system specific?

My env is, from the pytest run:

platform darwin -- Python 3.8.7, pytest-7.1.2, pluggy-1.0.0 -- ..../PyInquirer/venv/bin/python
cachedir: .pytest_cache
metadata: {'Python': '3.8.7', 'Platform': 'macOS-10.16-x86_64-i386-64bit', 'Packages': {'pytest': '7.1.2', 'py': '1.11.0', 'pluggy': '1.0.0'}, 'Plugins': {'xdist': '2.5.0', 'forked': '1.4.0', 'metadata': '2.0.1', 'html': '3.1.1', 'cov': '3.0.0'}}
rootdir: ..../PyInquirer
plugins: xdist-2.5.0, forked-1.4.0, metadata-2.0.1, html-3.1.1, cov-3.0.0
collected 23 items                                                                                                                                                            

2. The second issue seems to be an exception when trying to import PyInquirer in examples in some of the tests: ``` E assert "Traceback (m...PyInquirer'\n" == '😃 Select top... Extra cheese' E + Traceback (most recent call last): E + File "examples/checkbox.py", line 8, in E + from PyInquirer import prompt, Separator E + ModuleNotFoundError: No module named 'PyInquirer' ```
These are all after running through the basic steps of setting up the env:
$ git clone [email protected]:CITGuru/PyInquirer.git
$ cd PyInquirer
$ python -m venv venv
$ source venv/bin/activate
$ pip install --upgrade pip
$ pip install -r requirements.txt
$ pip install -r requirements_dev.txt

See full pytest output
pytest -sv tests/                                                     
============================================================================= test session starts =============================================================================
platform darwin -- Python 3.8.7, pytest-7.1.2, pluggy-1.0.0 -- /Users/MyUser/dev/PyInquirer/venv/bin/python
cachedir: .pytest_cache
metadata: {'Python': '3.8.7', 'Platform': 'macOS-10.16-x86_64-i386-64bit', 'Packages': {'pytest': '7.1.2', 'py': '1.11.0', 'pluggy': '1.0.0'}, 'Plugins': {'xdist': '2.5.0', 'forked': '1.4.0', 'metadata': '2.0.1', 'html': '3.1.1', 'cov': '3.0.0'}}
rootdir: /Users/MyUser/dev/PyInquirer
plugins: xdist-2.5.0, forked-1.4.0, metadata-2.0.1, html-3.1.1, cov-3.0.0
collected 23 items                                                                                                                                                            

tests/test_example_checkbox.py::test_checkbox len: 181
FAILED
tests/test_example_expand.py::test_without_expand FAILED
tests/test_example_expand.py::test_with_expand FAILED
tests/test_example_hierachical.py::test_hierarchical FAILED
tests/test_example_input.py::test_input FAILED
tests/test_example_list.py::test_list len: 177
FAILED
tests/test_example_password.py::test_password FAILED
tests/test_example_pizza.py::test_pizza FAILED
tests/test_example_rawlist.py::test_rawlist FAILED
tests/test_example_when.py::test_when_bacon FAILED
tests/test_example_when.py::test_when_pizza FAILED
tests/test_example_when.py::test_when_no_thanks FAILED
tests/test_helpers.py::test_remove_ansi_escape_sequences PASSED
tests/test_helpers.py::test_example_app PASSED
tests/test_helpers.py::test_example_app_dialog_style PASSED
tests/test_helpers.py::test_example_app_no_match PASSED
tests/test_helpers.py::test_example_app_regex PASSED
tests/test_helpers.py::test_example_app_regex_no_match PASSED
tests/test_prompts_list.py::test_select_first_choice FAILED
tests/test_prompts_list.py::test_select_second_choice FAILED
tests/test_prompts_list.py::test_select_third_choice FAILED
tests/test_prompts_list.py::test_cycle_to_first_choice FAILED
tests/test_prompts_list.py::test_cycle_backwards FAILED

================================================================================== FAILURES ===================================================================================
________________________________________________________________________________ test_checkbox ________________________________________________________________________________

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/checkbox.py'], env=environ({'APPLICAT...MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_checkbox.py::test_checkbox (call)'}))
text = '😃 Select toppings  (<up>, <down> to move, <space> to select, <a> to toggle, <i>\n  = The Meats =\n ❯○ Ham\n  ○ Ground...n  ○ Mushroom\n  ○ Tomato\n  ○ Pepperoni\n  = The extras =\n  ○ Pineapple\n  - Olives (out of stock)\n  ○ Extra cheese'

    def expect(self, text):
        """Read until equals text or timeout."""
        # inspired by pexpect/pty_spawn and  pexpect/expect.py expect_loop
        end_time = time.time() + self.timeout
        buf = ''
        while (end_time - time.time()) > 0.0:
            # switch to nonblocking read
            reads, _, _ = select.select([self.fd], [], [], end_time - time.time())
            if len(reads) > 0:
                try:
>                   buf = remove_ansi_escape_sequences(buf + self.read())

tests/helpers.py:207: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/checkbox.py'], env=environ({'APPLICAT...MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_checkbox.py::test_checkbox (call)'}))
size = 1024

    def read(self, size=1024):
        """Read at most ``size`` bytes from the pty, return them as unicode.
    
        Can block if there is nothing to read. Raises :exc:`EOFError` if the
        terminal was closed.
    
        The size argument still refers to bytes, not unicode code points.
        """
>       b = super(SimplePty, self).read(size)

tests/helpers.py:128: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/checkbox.py'], env=environ({'APPLICAT...MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_checkbox.py::test_checkbox (call)'}))
size = 1024

    def read(self, size=1024):
        """Read and return at most ``size`` bytes from the pty.
    
        Can block if there is nothing to read. Raises :exc:`EOFError` if the
        terminal was closed.
    
        Unlike Pexpect's ``read_nonblocking`` method, this doesn't try to deal
        with the vagaries of EOF on platforms that do strange things, like IRIX
        or older Solaris systems. It handles the errno=EIO pattern used on
        Linux, and the empty-string return used on BSD platforms and (seemingly)
        on recent Solaris.
        """
        try:
            s = self.fileobj.read(size)
        except (OSError, IOError) as err:
            if err.args[0] == errno.EIO:
                # Linux-style EOF
                self.flag_eof = True
                raise EOFError('End Of File (EOF). Exception style platform.')
            raise
        if s == b'':
            # BSD-style EOF (also appears to work on recent Solaris (OpenIndiana))
            self.flag_eof = True
>           raise EOFError('End Of File (EOF). Empty string style platform.')
E           EOFError: End Of File (EOF). Empty string style platform.

venv/lib/python3.8/site-packages/ptyprocess/ptyprocess.py:517: EOFError

During handling of the above exception, another exception occurred:

example_app = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/checkbox.py'], env=environ({'APPLICAT...MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_checkbox.py::test_checkbox (call)'}))

    def test_checkbox(example_app):
>       example_app.expect(textwrap.dedent("""\
            😃 Select toppings  (<up>, <down> to move, <space> to select, <a> to toggle, <i>
              = The Meats =
             ❯○ Ham
              ○ Ground Meat
              ○ Bacon
              = The Cheeses =
              ● Mozzarella
              ○ Cheddar
              ○ Parmesan
              = The usual =
              ○ Mushroom
              ○ Tomato
              ○ Pepperoni
              = The extras =
              ○ Pineapple
              - Olives (out of stock)
              ○ Extra cheese"""))

tests/test_example_checkbox.py:11: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/checkbox.py'], env=environ({'APPLICAT...MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_checkbox.py::test_checkbox (call)'}))
text = '😃 Select toppings  (<up>, <down> to move, <space> to select, <a> to toggle, <i>\n  = The Meats =\n ❯○ Ham\n  ○ Ground...n  ○ Mushroom\n  ○ Tomato\n  ○ Pepperoni\n  = The extras =\n  ○ Pineapple\n  - Olives (out of stock)\n  ○ Extra cheese'

    def expect(self, text):
        """Read until equals text or timeout."""
        # inspired by pexpect/pty_spawn and  pexpect/expect.py expect_loop
        end_time = time.time() + self.timeout
        buf = ''
        while (end_time - time.time()) > 0.0:
            # switch to nonblocking read
            reads, _, _ = select.select([self.fd], [], [], end_time - time.time())
            if len(reads) > 0:
                try:
                    buf = remove_ansi_escape_sequences(buf + self.read())
                except EOFError:
                    print('len: %d' % len(buf))
>                   assert buf == text
E                   assert "Traceback (m...PyInquirer'\n" == '😃 Select top... Extra cheese'
E                     + Traceback (most recent call last):
E                     +   File "examples/checkbox.py", line 8, in <module>
E                     +     from PyInquirer import prompt, Separator
E                     + ModuleNotFoundError: No module named 'PyInquirer'
E                     - 😃 Select toppings  (<up>, <down> to move, <space> to select, <a> to toggle, <i>
E                     -   = The Meats =
E                     -  ❯○ Ham...
E                     
E                     ...Full output truncated (15 lines hidden), use '-vv' to show

tests/helpers.py:210: AssertionError
_____________________________________________________________________________ test_without_expand _____________________________________________________________________________

example_app = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/expand.py'], env=environ({'APPLICATIO...f/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_expand.py::test_without_expand (call)'}))

    def test_without_expand(example_app):
>       example_app.expect(textwrap.dedent("""\
            ? Conflict on `file.js`:   (yAdxh)
            >> Overwrite this one and all next"""))

tests/test_example_expand.py:12: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/expand.py'], env=environ({'APPLICATIO...f/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_expand.py::test_without_expand (call)'}))
text = '? Conflict on `file.js`:   (yAdxh)\n>> Overwrite this one and all next'

    def expect(self, text):
        """Read until equals text or timeout."""
        # inspired by pexpect/pty_spawn and  pexpect/expect.py expect_loop
        end_time = time.time() + self.timeout
        buf = ''
        while (end_time - time.time()) > 0.0:
            # switch to nonblocking read
            reads, _, _ = select.select([self.fd], [], [], end_time - time.time())
            if len(reads) > 0:
                try:
                    buf = remove_ansi_escape_sequences(buf + self.read())
                except EOFError:
                    print('len: %d' % len(buf))
                    assert buf == text
                if buf == text:
                    return
                elif len(buf) >= len(text):
                    break
            else:
                # do not eat up CPU when waiting for the timeout to expire
                time.sleep(self.timeout/10)
        #print(repr(buf))  # debug ansi code handling
>       assert buf == text
E       assert 'Traceback (m...in <module>\n' == '? Conflict o... and all next'
E         - ? Conflict on `file.js`:   (yAdxh)
E         - >> Overwrite this one and all next
E         + Traceback (most recent call last):
E         +   File "examples/expand.py", line 6, in <module>

tests/helpers.py:219: AssertionError
______________________________________________________________________________ test_with_expand _______________________________________________________________________________

example_app = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/expand.py'], env=environ({'APPLICATIO...MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_expand.py::test_with_expand (call)'}))

    def test_with_expand(example_app):
>       example_app.expect(textwrap.dedent("""\
            ? Conflict on `file.js`:   (yAdxh)
            >> Overwrite this one and all next"""))

tests/test_example_expand.py:27: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/expand.py'], env=environ({'APPLICATIO...MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_expand.py::test_with_expand (call)'}))
text = '? Conflict on `file.js`:   (yAdxh)\n>> Overwrite this one and all next'

    def expect(self, text):
        """Read until equals text or timeout."""
        # inspired by pexpect/pty_spawn and  pexpect/expect.py expect_loop
        end_time = time.time() + self.timeout
        buf = ''
        while (end_time - time.time()) > 0.0:
            # switch to nonblocking read
            reads, _, _ = select.select([self.fd], [], [], end_time - time.time())
            if len(reads) > 0:
                try:
                    buf = remove_ansi_escape_sequences(buf + self.read())
                except EOFError:
                    print('len: %d' % len(buf))
                    assert buf == text
                if buf == text:
                    return
                elif len(buf) >= len(text):
                    break
            else:
                # do not eat up CPU when waiting for the timeout to expire
                time.sleep(self.timeout/10)
        #print(repr(buf))  # debug ansi code handling
>       assert buf == text
E       assert 'Traceback (m...in <module>\n' == '? Conflict o... and all next'
E         - ? Conflict on `file.js`:   (yAdxh)
E         - >> Overwrite this one and all next
E         + Traceback (most recent call last):
E         +   File "examples/expand.py", line 6, in <module>

tests/helpers.py:219: AssertionError
______________________________________________________________________________ test_hierarchical ______________________________________________________________________________

example_app = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/hierarchical.py'], env=environ({'APPL...ev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_hierachical.py::test_hierarchical (call)'}))

    def test_hierarchical(example_app):
>       example_app.expect(textwrap.dedent("""\
            You find yourself in a small room, there is a door in front of you.
            ? Which direction would you like to go?  (Use arrow keys)
             ❯ Forward
               Right
               Left
               Back"""))

tests/test_example_hierachical.py:11: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/hierarchical.py'], env=environ({'APPL...ev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_hierachical.py::test_hierarchical (call)'}))
text = 'You find yourself in a small room, there is a door in front of you.\n? Which direction would you like to go?  (Use arrow keys)\n ❯ Forward\n   Right\n   Left\n   Back'

    def expect(self, text):
        """Read until equals text or timeout."""
        # inspired by pexpect/pty_spawn and  pexpect/expect.py expect_loop
        end_time = time.time() + self.timeout
        buf = ''
        while (end_time - time.time()) > 0.0:
            # switch to nonblocking read
            reads, _, _ = select.select([self.fd], [], [], end_time - time.time())
            if len(reads) > 0:
                try:
                    buf = remove_ansi_escape_sequences(buf + self.read())
                except EOFError:
                    print('len: %d' % len(buf))
                    assert buf == text
                if buf == text:
                    return
                elif len(buf) >= len(text):
                    break
            else:
                # do not eat up CPU when waiting for the timeout to expire
                time.sleep(self.timeout/10)
        #print(repr(buf))  # debug ansi code handling
>       assert buf == text
E       assert "Traceback (m...PyInquirer'\n" == 'You find you...Left\n   Back'
E         + Traceback (most recent call last):
E         +   File "examples/hierarchical.py", line 5, in <module>
E         +     from PyInquirer import style_from_dict, prompt
E         + ModuleNotFoundError: No module named 'PyInquirer'
E         - You find yourself in a small room, there is a door in front of you.
E         - ? Which direction would you like to go?  (Use arrow keys)
E         -  ❯ Forward...
E         
E         ...Full output truncated (4 lines hidden), use '-vv' to show

tests/helpers.py:219: AssertionError
_________________________________________________________________________________ test_input __________________________________________________________________________________

example_app = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/input.py'], env=environ({'APPLICATION...MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_input.py::test_input (call)'}))

    def test_input(example_app):
>       example_app.expect(textwrap.dedent("""\
            ? What's your first name  """))

tests/test_example_input.py:12: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/input.py'], env=environ({'APPLICATION...MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_input.py::test_input (call)'}))
text = "? What's your first name  "

    def expect(self, text):
        """Read until equals text or timeout."""
        # inspired by pexpect/pty_spawn and  pexpect/expect.py expect_loop
        end_time = time.time() + self.timeout
        buf = ''
        while (end_time - time.time()) > 0.0:
            # switch to nonblocking read
            reads, _, _ = select.select([self.fd], [], [], end_time - time.time())
            if len(reads) > 0:
                try:
                    buf = remove_ansi_escape_sequences(buf + self.read())
                except EOFError:
                    print('len: %d' % len(buf))
                    assert buf == text
                if buf == text:
                    return
                elif len(buf) >= len(text):
                    break
            else:
                # do not eat up CPU when waiting for the timeout to expire
                time.sleep(self.timeout/10)
        #print(repr(buf))  # debug ansi code handling
>       assert buf == text
E       assert 'Traceback (m...in <module>\n' == "? What's your first name  "
E         - ? What's your first name  
E         + Traceback (most recent call last):
E         +   File "examples/input.py", line 12, in <module>

tests/helpers.py:219: AssertionError
__________________________________________________________________________________ test_list __________________________________________________________________________________

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/list.py'], env=environ({'APPLICATION_.../MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_list.py::test_list (call)'}))
text = '? What do you want to do?  (Use arrow keys)\n ❯ Order a pizza\n   Make a reservation\n  ---------------\n   Ask for opening hours\n   - Contact support (Unavailable at this time)\n   Talk to the receptionist'

    def expect(self, text):
        """Read until equals text or timeout."""
        # inspired by pexpect/pty_spawn and  pexpect/expect.py expect_loop
        end_time = time.time() + self.timeout
        buf = ''
        while (end_time - time.time()) > 0.0:
            # switch to nonblocking read
            reads, _, _ = select.select([self.fd], [], [], end_time - time.time())
            if len(reads) > 0:
                try:
>                   buf = remove_ansi_escape_sequences(buf + self.read())

tests/helpers.py:207: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/list.py'], env=environ({'APPLICATION_.../MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_list.py::test_list (call)'}))
size = 1024

    def read(self, size=1024):
        """Read at most ``size`` bytes from the pty, return them as unicode.
    
        Can block if there is nothing to read. Raises :exc:`EOFError` if the
        terminal was closed.
    
        The size argument still refers to bytes, not unicode code points.
        """
>       b = super(SimplePty, self).read(size)

tests/helpers.py:128: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/list.py'], env=environ({'APPLICATION_.../MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_list.py::test_list (call)'}))
size = 1024

    def read(self, size=1024):
        """Read and return at most ``size`` bytes from the pty.
    
        Can block if there is nothing to read. Raises :exc:`EOFError` if the
        terminal was closed.
    
        Unlike Pexpect's ``read_nonblocking`` method, this doesn't try to deal
        with the vagaries of EOF on platforms that do strange things, like IRIX
        or older Solaris systems. It handles the errno=EIO pattern used on
        Linux, and the empty-string return used on BSD platforms and (seemingly)
        on recent Solaris.
        """
        try:
            s = self.fileobj.read(size)
        except (OSError, IOError) as err:
            if err.args[0] == errno.EIO:
                # Linux-style EOF
                self.flag_eof = True
                raise EOFError('End Of File (EOF). Exception style platform.')
            raise
        if s == b'':
            # BSD-style EOF (also appears to work on recent Solaris (OpenIndiana))
            self.flag_eof = True
>           raise EOFError('End Of File (EOF). Empty string style platform.')
E           EOFError: End Of File (EOF). Empty string style platform.

venv/lib/python3.8/site-packages/ptyprocess/ptyprocess.py:517: EOFError

During handling of the above exception, another exception occurred:

example_app = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/list.py'], env=environ({'APPLICATION_.../MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_list.py::test_list (call)'}))

    def test_list(example_app):
>       example_app.expect(textwrap.dedent("""\
            ? What do you want to do?  (Use arrow keys)
             ❯ Order a pizza
               Make a reservation
              ---------------
               Ask for opening hours
               - Contact support (Unavailable at this time)
               Talk to the receptionist"""))

tests/test_example_list.py:12: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/list.py'], env=environ({'APPLICATION_.../MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_list.py::test_list (call)'}))
text = '? What do you want to do?  (Use arrow keys)\n ❯ Order a pizza\n   Make a reservation\n  ---------------\n   Ask for opening hours\n   - Contact support (Unavailable at this time)\n   Talk to the receptionist'

    def expect(self, text):
        """Read until equals text or timeout."""
        # inspired by pexpect/pty_spawn and  pexpect/expect.py expect_loop
        end_time = time.time() + self.timeout
        buf = ''
        while (end_time - time.time()) > 0.0:
            # switch to nonblocking read
            reads, _, _ = select.select([self.fd], [], [], end_time - time.time())
            if len(reads) > 0:
                try:
                    buf = remove_ansi_escape_sequences(buf + self.read())
                except EOFError:
                    print('len: %d' % len(buf))
>                   assert buf == text
E                   assert "Traceback (m...PyInquirer'\n" == '? What do yo... receptionist'
E                     + Traceback (most recent call last):
E                     +   File "examples/list.py", line 9, in <module>
E                     +     from PyInquirer import prompt, Separator
E                     + ModuleNotFoundError: No module named 'PyInquirer'
E                     - ? What do you want to do?  (Use arrow keys)
E                     -  ❯ Order a pizza
E                     -    Make a reservation...
E                     
E                     ...Full output truncated (5 lines hidden), use '-vv' to show

tests/helpers.py:210: AssertionError
________________________________________________________________________________ test_password ________________________________________________________________________________

example_app = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/password.py'], env=environ({'APPLICAT...MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_password.py::test_password (call)'}))

    def test_password(example_app):
>       example_app.expect(textwrap.dedent("""\
            ? Enter your git password"""))

tests/test_example_password.py:11: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/password.py'], env=environ({'APPLICAT...MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_password.py::test_password (call)'}))
text = '? Enter your git password'

    def expect(self, text):
        """Read until equals text or timeout."""
        # inspired by pexpect/pty_spawn and  pexpect/expect.py expect_loop
        end_time = time.time() + self.timeout
        buf = ''
        while (end_time - time.time()) > 0.0:
            # switch to nonblocking read
            reads, _, _ = select.select([self.fd], [], [], end_time - time.time())
            if len(reads) > 0:
                try:
                    buf = remove_ansi_escape_sequences(buf + self.read())
                except EOFError:
                    print('len: %d' % len(buf))
                    assert buf == text
                if buf == text:
                    return
                elif len(buf) >= len(text):
                    break
            else:
                # do not eat up CPU when waiting for the timeout to expire
                time.sleep(self.timeout/10)
        #print(repr(buf))  # debug ansi code handling
>       assert buf == text
E       assert 'Traceback (m...in <module>\n' == '? Enter your git password'
E         - ? Enter your git password
E         + Traceback (most recent call last):
E         +   File "examples/password.py", line 7, in <module>

tests/helpers.py:219: AssertionError
_________________________________________________________________________________ test_pizza __________________________________________________________________________________

example_app = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/pizza.py'], env=environ({'APPLICATION...MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_pizza.py::test_pizza (call)'}))

    def test_pizza(example_app):
>       example_app.expect(textwrap.dedent("""\
            Hi, welcome to Python Pizza
            ? Is this for delivery?  (y/N)"""))

tests/test_example_pizza.py:11: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/pizza.py'], env=environ({'APPLICATION...MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_pizza.py::test_pizza (call)'}))
text = 'Hi, welcome to Python Pizza\n? Is this for delivery?  (y/N)'

    def expect(self, text):
        """Read until equals text or timeout."""
        # inspired by pexpect/pty_spawn and  pexpect/expect.py expect_loop
        end_time = time.time() + self.timeout
        buf = ''
        while (end_time - time.time()) > 0.0:
            # switch to nonblocking read
            reads, _, _ = select.select([self.fd], [], [], end_time - time.time())
            if len(reads) > 0:
                try:
                    buf = remove_ansi_escape_sequences(buf + self.read())
                except EOFError:
                    print('len: %d' % len(buf))
                    assert buf == text
                if buf == text:
                    return
                elif len(buf) >= len(text):
                    break
            else:
                # do not eat up CPU when waiting for the timeout to expire
                time.sleep(self.timeout/10)
        #print(repr(buf))  # debug ansi code handling
>       assert buf == text
E       assert 'Traceback (m...in <module>\n' == 'Hi, welcome ...ivery?  (y/N)'
E         - Hi, welcome to Python Pizza
E         - ? Is this for delivery?  (y/N)
E         + Traceback (most recent call last):
E         +   File "examples/pizza.py", line 13, in <module>

tests/helpers.py:219: AssertionError
________________________________________________________________________________ test_rawlist _________________________________________________________________________________

example_app = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/rawlist.py'], env=environ({'APPLICATI...enMyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_rawlist.py::test_rawlist (call)'}))

    def test_rawlist(example_app):
>       example_app.expect(textwrap.dedent("""\
            ? What do you want to do?
              1) Order a pizza
              2) Make a reservation
               ---------------
              3) Ask opening hours
              4) Talk to the receptionist
              Answer: 1"""))

tests/test_example_rawlist.py:12: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/rawlist.py'], env=environ({'APPLICATI...enMyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_rawlist.py::test_rawlist (call)'}))
text = '? What do you want to do?\n  1) Order a pizza\n  2) Make a reservation\n   ---------------\n  3) Ask opening hours\n  4) Talk to the receptionist\n  Answer: 1'

    def expect(self, text):
        """Read until equals text or timeout."""
        # inspired by pexpect/pty_spawn and  pexpect/expect.py expect_loop
        end_time = time.time() + self.timeout
        buf = ''
        while (end_time - time.time()) > 0.0:
            # switch to nonblocking read
            reads, _, _ = select.select([self.fd], [], [], end_time - time.time())
            if len(reads) > 0:
                try:
                    buf = remove_ansi_escape_sequences(buf + self.read())
                except EOFError:
                    print('len: %d' % len(buf))
                    assert buf == text
                if buf == text:
                    return
                elif len(buf) >= len(text):
                    break
            else:
                # do not eat up CPU when waiting for the timeout to expire
                time.sleep(self.timeout/10)
        #print(repr(buf))  # debug ansi code handling
>       assert buf == text
E       assert "Traceback (m...PyInquirer'\n" == '? What do yo...\n  Answer: 1'
E         + Traceback (most recent call last):
E         +   File "examples/rawlist.py", line 8, in <module>
E         +     from PyInquirer import prompt, print_json, Separator
E         + ModuleNotFoundError: No module named 'PyInquirer'
E         - ? What do you want to do?
E         -   1) Order a pizza
E         -   2) Make a reservation...
E         
E         ...Full output truncated (5 lines hidden), use '-vv' to show

tests/helpers.py:219: AssertionError
_______________________________________________________________________________ test_when_bacon _______________________________________________________________________________

example_app = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/when.py'], env=environ({'APPLICATION_...enMyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_when.py::test_when_bacon (call)'}))

    def test_when_bacon(example_app):
>       example_app.expect('? Do you like bacon?  (Y/n)')

tests/test_example_when.py:12: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/when.py'], env=environ({'APPLICATION_...enMyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_when.py::test_when_bacon (call)'}))
text = '? Do you like bacon?  (Y/n)'

    def expect(self, text):
        """Read until equals text or timeout."""
        # inspired by pexpect/pty_spawn and  pexpect/expect.py expect_loop
        end_time = time.time() + self.timeout
        buf = ''
        while (end_time - time.time()) > 0.0:
            # switch to nonblocking read
            reads, _, _ = select.select([self.fd], [], [], end_time - time.time())
            if len(reads) > 0:
                try:
                    buf = remove_ansi_escape_sequences(buf + self.read())
                except EOFError:
                    print('len: %d' % len(buf))
                    assert buf == text
                if buf == text:
                    return
                elif len(buf) >= len(text):
                    break
            else:
                # do not eat up CPU when waiting for the timeout to expire
                time.sleep(self.timeout/10)
        #print(repr(buf))  # debug ansi code handling
>       assert buf == text
E       assert 'Traceback (m...in <module>\n' == '? Do you like bacon?  (Y/n)'
E         - ? Do you like bacon?  (Y/n)
E         + Traceback (most recent call last):
E         +   File "examples/when.py", line 7, in <module>

tests/helpers.py:219: AssertionError
_______________________________________________________________________________ test_when_pizza _______________________________________________________________________________

example_app = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/when.py'], env=environ({'APPLICATION_...enMyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_when.py::test_when_pizza (call)'}))

    def test_when_pizza(example_app):
>       example_app.expect('? Do you like bacon?  (Y/n)')

tests/test_example_when.py:29: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/when.py'], env=environ({'APPLICATION_...enMyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_when.py::test_when_pizza (call)'}))
text = '? Do you like bacon?  (Y/n)'

    def expect(self, text):
        """Read until equals text or timeout."""
        # inspired by pexpect/pty_spawn and  pexpect/expect.py expect_loop
        end_time = time.time() + self.timeout
        buf = ''
        while (end_time - time.time()) > 0.0:
            # switch to nonblocking read
            reads, _, _ = select.select([self.fd], [], [], end_time - time.time())
            if len(reads) > 0:
                try:
                    buf = remove_ansi_escape_sequences(buf + self.read())
                except EOFError:
                    print('len: %d' % len(buf))
                    assert buf == text
                if buf == text:
                    return
                elif len(buf) >= len(text):
                    break
            else:
                # do not eat up CPU when waiting for the timeout to expire
                time.sleep(self.timeout/10)
        #print(repr(buf))  # debug ansi code handling
>       assert buf == text
E       assert 'Traceback (m...in <module>\n' == '? Do you like bacon?  (Y/n)'
E         - ? Do you like bacon?  (Y/n)
E         + Traceback (most recent call last):
E         +   File "examples/when.py", line 7, in <module>

tests/helpers.py:219: AssertionError
_____________________________________________________________________________ test_when_no_thanks _____________________________________________________________________________

example_app = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/when.py'], env=environ({'APPLICATION_...MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_when.py::test_when_no_thanks (call)'}))

    def test_when_no_thanks(example_app):
>       example_app.expect('? Do you like bacon?  (Y/n)')

tests/test_example_when.py:53: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = SimplePty.spawn(['/Users/MyUser/dev/PyInquirer/venv/bin/python', 'examples/when.py'], env=environ({'APPLICATION_...MyUser/dev/PyInquirer/venv/bin/pytest', 'PYTEST_CURRENT_TEST': 'tests/test_example_when.py::test_when_no_thanks (call)'}))
text = '? Do you like bacon?  (Y/n)'

    def expect(self, text):
        """Read until equals text or timeout."""
        # inspired by pexpect/pty_spawn and  pexpect/expect.py expect_loop
        end_time = time.time() + self.timeout
        buf = ''
        while (end_time - time.time()) > 0.0:
            # switch to nonblocking read
            reads, _, _ = select.select([self.fd], [], [], end_time - time.time())
            if len(reads) > 0:
                try:
                    buf = remove_ansi_escape_sequences(buf + self.read())
                except EOFError:
                    print('len: %d' % len(buf))
                    assert buf == text
                if buf == text:
                    return
                elif len(buf) >= len(text):
                    break
            else:
                # do not eat up CPU when waiting for the timeout to expire
                time.sleep(self.timeout/10)
        #print(repr(buf))  # debug ansi code handling
>       assert buf == text
E       assert 'Traceback (m...in <module>\n' == '? Do you like bacon?  (Y/n)'
E         - ? Do you like bacon?  (Y/n)
E         + Traceback (most recent call last):
E         +   File "examples/when.py", line 7, in <module>

tests/helpers.py:219: AssertionError
__________________________________________________________________________ test_select_first_choice ___________________________________________________________________________

    def test_select_first_choice():
        message = 'Foo message'
        name = 'Bar variable'
        kwargs = {
            'choices': ['foo', 'bar', 'bazz']
        }
        text = keys.ENTER
    
>       result = feed_app_with_input('list', message, text, **kwargs)

tests/test_prompts_list.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/helpers.py:67: in feed_app_with_input
    inp = PosixPipeInput(text)
venv/lib/python3.8/site-packages/prompt_toolkit/input/posix_pipe.py:75: in __init__
    super().__init__(cast(TextIO, Stdin()))
venv/lib/python3.8/site-packages/prompt_toolkit/input/vt100.py:52: in __init__
    stdin.fileno()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

stdin = <prompt_toolkit.input.posix_pipe.PosixPipeInput.__init__.<locals>.Stdin object at 0x107f792e0>

    def fileno(stdin) -> int:
>       return self.pipe.read_fd
E       AttributeError: 'str' object has no attribute 'read_fd'

venv/lib/python3.8/site-packages/prompt_toolkit/input/posix_pipe.py:73: AttributeError
__________________________________________________________________________ test_select_second_choice __________________________________________________________________________

    def test_select_second_choice():
        message = 'Foo message'
        name = 'Bar variable'
        kwargs = {
            'choices': ['foo', 'bar', 'bazz']
        }
        text = keys.DOWN + keys.ENTER
    
>       result = feed_app_with_input('list', message, text, **kwargs)

tests/test_prompts_list.py:26: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/helpers.py:67: in feed_app_with_input
    inp = PosixPipeInput(text)
venv/lib/python3.8/site-packages/prompt_toolkit/input/posix_pipe.py:75: in __init__
    super().__init__(cast(TextIO, Stdin()))
venv/lib/python3.8/site-packages/prompt_toolkit/input/vt100.py:52: in __init__
    stdin.fileno()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

stdin = <prompt_toolkit.input.posix_pipe.PosixPipeInput.__init__.<locals>.Stdin object at 0x108009d90>

    def fileno(stdin) -> int:
>       return self.pipe.read_fd
E       AttributeError: 'str' object has no attribute 'read_fd'

venv/lib/python3.8/site-packages/prompt_toolkit/input/posix_pipe.py:73: AttributeError
__________________________________________________________________________ test_select_third_choice ___________________________________________________________________________

    def test_select_third_choice():
        message = 'Foo message'
        name = 'Bar variable'
        kwargs = {
            'choices': ['foo', 'bar', 'bazz']
        }
        text = keys.DOWN + keys.DOWN + keys.ENTER
    
>       result = feed_app_with_input('list', message, text, **kwargs)

tests/test_prompts_list.py:38: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/helpers.py:67: in feed_app_with_input
    inp = PosixPipeInput(text)
venv/lib/python3.8/site-packages/prompt_toolkit/input/posix_pipe.py:75: in __init__
    super().__init__(cast(TextIO, Stdin()))
venv/lib/python3.8/site-packages/prompt_toolkit/input/vt100.py:52: in __init__
    stdin.fileno()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

stdin = <prompt_toolkit.input.posix_pipe.PosixPipeInput.__init__.<locals>.Stdin object at 0x1080950a0>

    def fileno(stdin) -> int:
>       return self.pipe.read_fd
E       AttributeError: 'str' object has no attribute 'read_fd'

venv/lib/python3.8/site-packages/prompt_toolkit/input/posix_pipe.py:73: AttributeError
_________________________________________________________________________ test_cycle_to_first_choice __________________________________________________________________________

    def test_cycle_to_first_choice():
        message = 'Foo message'
        name = 'Bar variable'
        kwargs = {
            'choices': ['foo', 'bar', 'bazz']
        }
        text = keys.DOWN + keys.DOWN + keys.DOWN + keys.ENTER
    
>       result = feed_app_with_input('list', message, text, **kwargs)

tests/test_prompts_list.py:50: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/helpers.py:67: in feed_app_with_input
    inp = PosixPipeInput(text)
venv/lib/python3.8/site-packages/prompt_toolkit/input/posix_pipe.py:75: in __init__
    super().__init__(cast(TextIO, Stdin()))
venv/lib/python3.8/site-packages/prompt_toolkit/input/vt100.py:52: in __init__
    stdin.fileno()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

stdin = <prompt_toolkit.input.posix_pipe.PosixPipeInput.__init__.<locals>.Stdin object at 0x107f93c70>

    def fileno(stdin) -> int:
>       return self.pipe.read_fd
E       AttributeError: 'str' object has no attribute 'read_fd'

venv/lib/python3.8/site-packages/prompt_toolkit/input/posix_pipe.py:73: AttributeError
____________________________________________________________________________ test_cycle_backwards _____________________________________________________________________________

    def test_cycle_backwards():
        message = 'Foo message'
        name = 'Bar variable'
        kwargs = {
            'choices': ['foo', 'bar', 'bazz']
        }
        text = keys.UP + keys.ENTER
    
>       result = feed_app_with_input('list', message, text, **kwargs)

tests/test_prompts_list.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/helpers.py:67: in feed_app_with_input
    inp = PosixPipeInput(text)
venv/lib/python3.8/site-packages/prompt_toolkit/input/posix_pipe.py:75: in __init__
    super().__init__(cast(TextIO, Stdin()))
venv/lib/python3.8/site-packages/prompt_toolkit/input/vt100.py:52: in __init__
    stdin.fileno()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

stdin = <prompt_toolkit.input.posix_pipe.PosixPipeInput.__init__.<locals>.Stdin object at 0x1080b5b80>

    def fileno(stdin) -> int:
>       return self.pipe.read_fd
E       AttributeError: 'str' object has no attribute 'read_fd'

venv/lib/python3.8/site-packages/prompt_toolkit/input/posix_pipe.py:73: AttributeError
=========================================================================== short test summary info ===========================================================================
FAILED tests/test_example_checkbox.py::test_checkbox - assert "Traceback (m...PyInquirer'\n" == '😃 Select top... Extra cheese'
FAILED tests/test_example_expand.py::test_without_expand - assert 'Traceback (m...in <module>\n' == '? Conflict o... and all next'
FAILED tests/test_example_expand.py::test_with_expand - assert 'Traceback (m...in <module>\n' == '? Conflict o... and all next'
FAILED tests/test_example_hierachical.py::test_hierarchical - assert "Traceback (m...PyInquirer'\n" == 'You find you...Left\n   Back'
FAILED tests/test_example_input.py::test_input - assert 'Traceback (m...in <module>\n' == "? What's your first name  "
FAILED tests/test_example_list.py::test_list - assert "Traceback (m...PyInquirer'\n" == '? What do yo... receptionist'
FAILED tests/test_example_password.py::test_password - assert 'Traceback (m...in <module>\n' == '? Enter your git password'
FAILED tests/test_example_pizza.py::test_pizza - assert 'Traceback (m...in <module>\n' == 'Hi, welcome ...ivery?  (y/N)'
FAILED tests/test_example_rawlist.py::test_rawlist - assert "Traceback (m...PyInquirer'\n" == '? What do yo...\n  Answer: 1'
FAILED tests/test_example_when.py::test_when_bacon - assert 'Traceback (m...in <module>\n' == '? Do you like bacon?  (Y/n)'
FAILED tests/test_example_when.py::test_when_pizza - assert 'Traceback (m...in <module>\n' == '? Do you like bacon?  (Y/n)'
FAILED tests/test_example_when.py::test_when_no_thanks - assert 'Traceback (m...in <module>\n' == '? Do you like bacon?  (Y/n)'
FAILED tests/test_prompts_list.py::test_select_first_choice - AttributeError: 'str' object has no attribute 'read_fd'
FAILED tests/test_prompts_list.py::test_select_second_choice - AttributeError: 'str' object has no attribute 'read_fd'
FAILED tests/test_prompts_list.py::test_select_third_choice - AttributeError: 'str' object has no attribute 'read_fd'
FAILED tests/test_prompts_list.py::test_cycle_to_first_choice - AttributeError: 'str' object has no attribute 'read_fd'
FAILED tests/test_prompts_list.py::test_cycle_backwards - AttributeError: 'str' object has no attribute 'read_fd'
======================================================================== 17 failed, 6 passed in 13.08s ========================================================================

Thank you for your help!

Roy.

@MaxG87
Copy link

MaxG87 commented Oct 5, 2022

I do not have a workaround, but I am experiencing the same issue. I tested Python 3.7, 3.9 and 3.10 and various commits of PyInquirer. I was unable to find anything that would pass the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants