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

Add offset argument to seek in io test #496

Merged
merged 1 commit into from
Mar 26, 2020

Conversation

bollwyvl
Copy link
Contributor

while trying to package ipykernel for pypy on conda, we've run uncovered a small issue:

=================================== FAILURES ===================================
_________________________________ test_io_api __________________________________

    def test_io_api():
        """Test that wrapped stdout has the same API as a normal TextIO object"""
        session = Session()
        ctx = zmq.Context()
        pub = ctx.socket(zmq.PUB)
        thread = IOPubThread(pub)
        thread.start()
    
        stream = OutStream(session, thread, 'stdout')
    
        # cleanup unused zmq objects before we start testing
        thread.stop()
        thread.close()
        ctx.term()
    
        assert stream.errors is None
        assert not stream.isatty()
        with nt.assert_raises(io.UnsupportedOperation):
            stream.detach()
        with nt.assert_raises(io.UnsupportedOperation):
            next(stream)
        with nt.assert_raises(io.UnsupportedOperation):
            stream.read()
        with nt.assert_raises(io.UnsupportedOperation):
            stream.readline()
        with nt.assert_raises(io.UnsupportedOperation):
>           stream.seek()
E           TypeError: seek() missing 1 required positional argument: 'offset'

Docs suggest this is indeed the case: https://docs.python.org/3/library/io.html#io.IOBase.seek

The fix just gives it 0, but doesn't seem like it matters much, as it appears we're just checking that it subsequently fails.

Will skip the test on conda-forge, but it would be nice to have this for the next go-around... too bad i didn't find it earlier!

Copy link
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@blink1073 blink1073 merged commit ff122dd into ipython:master Mar 26, 2020
@blink1073 blink1073 modified the milestone: 5.3 May 20, 2020
@Carreau Carreau added this to the 5.4 milestone Jun 14, 2021
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

Successfully merging this pull request may close these issues.

3 participants