Skip to content

test_subprocess_pipe fails with ProcessLookupError #1125

@socram8888

Description

@socram8888

Steps to reproduce

  1. Install a dev setup as specified in CONTRIBUTING.rst

  2. Run make test

Expected behaviour

Tests should pass

Actual behaviour

test_subprocess_pipe fails with ProcessLookupError. The process finishes before the os.kill call is made, and thus the exception is being raised.

Configuration

Operating System: Ubuntu 16.04 on Windows 10

Version of Python, python-telegram-bot & dependencies: Python 3.5.2, bot on commit 42daf96 (latest available)

Logs

____________________________________________________________________________________________________ TestInputFile.test_subprocess_pipe _____________________________________________________________________________________________________

self = <tests.test_inputfile.TestInputFile object at 0x7ff6fce846a0>

    def test_subprocess_pipe(self):
        if sys.platform == 'win32':
            cmd = ['type', self.png]
        else:
            cmd = ['cat', self.png]

        proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=(sys.platform == 'win32'))
        in_file = InputFile({'photo': proc.stdout})

        assert in_file.input_file_content == open(self.png, 'rb').read()
        assert in_file.mimetype == 'image/png'
        assert in_file.filename == 'image.png'

>       proc.kill()

tests/test_inputfile.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.5/subprocess.py:1787: in kill
    self.send_signal(signal.SIGKILL)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <subprocess.Popen object at 0x7ff6fce84550>, sig = <Signals.SIGKILL: 9>

    def send_signal(self, sig):
        """Send a signal to the process."""
        # Skip signalling a process that we know has already died.
        if self.returncode is None:
>           os.kill(self.pid, sig)
E           ProcessLookupError: [Errno 3] No such process

/usr/lib/python3.5/subprocess.py:1777: ProcessLookupError```

Metadata

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