[issue41322] unittest: deprecate test methods returning non-None values

Ryan Mast (nightlark) report at bugs.python.org
Fri Aug 20 23:49:36 EDT 2021


Ryan Mast (nightlark) <mast.ryan at gmail.com> added the comment:

Would rewriting the test so that it doesn't yield be the right fix?

```
    def test_subprocess_wait_no_same_group(self):
        # start the new process in a new session
        connect = self.loop.subprocess_shell(
                        functools.partial(MySubprocessProtocol, self.loop),
                        'exit 7', stdin=None, stdout=None, stderr=None,
                        start_new_session=True)
        _, proto = yield self.loop.run_until_complete(connect)
        self.assertIsInstance(proto, MySubprocessProtocol)
        self.loop.run_until_complete(proto.completed)
        self.assertEqual(7, proto.returncode)
```

to

```
def test_subprocess_wait_no_same_group(self):
        # start the new process in a new session
        connect = self.loop.subprocess_shell(
                        functools.partial(MySubprocessProtocol, self.loop),
                        'exit 7', stdin=None, stdout=None, stderr=None,
                        start_new_session=True)
        transp, proto = self.loop.run_until_complete(connect)
        self.assertIsInstance(proto, MySubprocessProtocol)
        self.loop.run_until_complete(proto.completed)
        self.assertEqual(7, proto.returncode)
        transp.close()
```

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41322>
_______________________________________


More information about the Python-bugs-list mailing list