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

Test failures on access of sys.ps1 and sys.ps2 #4

Closed
TimothyFitz opened this issue Aug 17, 2018 · 0 comments
Closed

Test failures on access of sys.ps1 and sys.ps2 #4

TimothyFitz opened this issue Aug 17, 2018 · 0 comments

Comments

@TimothyFitz
Copy link
Contributor

I'm trying to fix an unrelated bug, and ran into 2 tests that aren't currently passing. Run inside pipenv with pytest, python 3.6.5 on Ubuntu 18.04.

Looking at the docs, sys.ps1 and sys.ps2 shouldn't be available outside of a python process started in interactive mode, so it seems like the test should fail. That's confusing, because aiomanhole 0.5.0 is successfully running in our gunicorn/aiohttp server which definitely isn't a python process started in interactive mode.

(aiomanhole-YgGsKdnF) timothyfitz@timothy-yoga-mk2:~/Packages/aiomanhole$ pytest ./test_aiomanhole.py 
========================================================== test session starts ==========================================================
platform linux -- Python 3.6.5, pytest-3.7.1, py-1.5.4, pluggy-0.7.1
rootdir: /home/timothyfitz/Packages/aiomanhole, inifile:
collected 21 items                                                                                                                      

test_aiomanhole.py .............FF......                                                                                          [100%]

=============================================================== FAILURES ================================================================
__________________________________________ TestInteractiveInterpreter.test_write_prompt[True] ___________________________________________

self = <test_aiomanhole.TestInteractiveInterpreter object at 0x7fc62ac9ba58>
interpreter = <aiomanhole.InteractiveInterpreter object at 0x7fc62ac9bb00>
loop = <_UnixSelectorEventLoop running=False closed=False debug=False>, partial = True

    @pytest.mark.parametrize('partial', [True, False])
    def test_write_prompt(self, interpreter, loop, partial):
        with mock.patch.object(interpreter.compiler, 'is_partial_command', return_value=partial):
>           loop.run_until_complete(interpreter.write_prompt())

test_aiomanhole.py:157: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.6/asyncio/base_events.py:468: in run_until_complete
    return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <aiomanhole.InteractiveInterpreter object at 0x7fc62ac9bb00>

    @asyncio.coroutine
    def write_prompt(self):
        writer = self.writer
    
        if self.compiler.is_partial_command():
>           writer.write(sys.ps2.encode('utf8'))
E           AttributeError: module 'sys' has no attribute 'ps2'

aiomanhole/__init__.py:114: AttributeError
__________________________________________ TestInteractiveInterpreter.test_write_prompt[False] __________________________________________

self = <test_aiomanhole.TestInteractiveInterpreter object at 0x7fc62aa0a2e8>
interpreter = <aiomanhole.InteractiveInterpreter object at 0x7fc62aa0a4a8>
loop = <_UnixSelectorEventLoop running=False closed=False debug=False>, partial = False

    @pytest.mark.parametrize('partial', [True, False])
    def test_write_prompt(self, interpreter, loop, partial):
        with mock.patch.object(interpreter.compiler, 'is_partial_command', return_value=partial):
>           loop.run_until_complete(interpreter.write_prompt())

test_aiomanhole.py:157: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.6/asyncio/base_events.py:468: in run_until_complete
    return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <aiomanhole.InteractiveInterpreter object at 0x7fc62aa0a4a8>

    @asyncio.coroutine
    def write_prompt(self):
        writer = self.writer
    
        if self.compiler.is_partial_command():
            writer.write(sys.ps2.encode('utf8'))
        else:
>           writer.write(sys.ps1.encode('utf8'))
E           AttributeError: module 'sys' has no attribute 'ps1'

aiomanhole/__init__.py:116: AttributeError
================================================== 2 failed, 19 passed in 0.17 seconds ==================================================
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

1 participant