(self, client=['client.py'], server=['server.py'], sleep=0)
| 79 | self.assertEqual(actual, expected) |
| 80 | |
| 81 | def test_client_server(self, client=['client.py'], server=['server.py'], sleep=0): |
| 82 | with Popen(server) as s: |
| 83 | if sleep: |
| 84 | time.sleep(sleep) |
| 85 | with run(client) as c: |
| 86 | s.terminate() |
| 87 | actual = [line.strip() for line in c.stdout] |
| 88 | inputs = ["Twas brillig, and the slithy toves", |
| 89 | "Did gire and gymble in the wabe.", |
| 90 | "All mimsy were the borogroves,", |
| 91 | "And the mome raths outgrabe."] |
| 92 | expected = ["%s => %s" % (line, line.upper()) for line in inputs] |
| 93 | self.assertEqual(actual, expected) |
| 94 | |
| 95 | def test_sync_client_server(self): |
| 96 | self.test_client_server(client=['sync_client.py']) |
no test coverage detected