Merge lp:~stevenk/python-fixtures/fakeprocess-kill into lp:~python-fixtures/python-fixtures/trunk

Proposed by Steve Kowalik
Status: Merged
Merged at revision: 78
Proposed branch: lp:~stevenk/python-fixtures/fakeprocess-kill
Merge into: lp:~python-fixtures/python-fixtures/trunk
Prerequisite: lp:~stevenk/python-fixtures/fakeopen-with
Diff against target: 37 lines (+8/-0)
3 files modified
NEWS (+1/-0)
lib/fixtures/_fixtures/popen.py (+3/-0)
lib/fixtures/tests/_fixtures/test_popen.py (+4/-0)
To merge this branch: bzr merge lp:~stevenk/python-fixtures/fakeprocess-kill
Reviewer Review Type Date Requested Status
python-fixtures committers Pending
Review via email: mp+231296@code.launchpad.net

Description of the change

Python 3.3+ may call subprocess.kill() in some cases, so FakeProcess should support that interface.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2014-08-19 04:44:18 +0000
+++ NEWS 2014-08-19 04:44:18 +0000
@@ -11,6 +11,7 @@
1111
12* ``FakePopen`` now supports being called under a context manager (IE: with).12* ``FakePopen`` now supports being called under a context manager (IE: with).
13 (Steve Kowalik)13 (Steve Kowalik)
14* ``FakeProcess`` now supports kill(). (Steve Kowalik)
1415
150.3.14160.3.14
16~~~~~~17~~~~~~
1718
=== modified file 'lib/fixtures/_fixtures/popen.py'
--- lib/fixtures/_fixtures/popen.py 2014-08-19 04:44:18 +0000
+++ lib/fixtures/_fixtures/popen.py 2014-08-19 04:44:18 +0000
@@ -54,6 +54,9 @@
54 def __exit__(self, exc_type, exc_value, traceback):54 def __exit__(self, exc_type, exc_value, traceback):
55 self.wait()55 self.wait()
5656
57 def kill(self):
58 pass
59
57 def wait(self):60 def wait(self):
58 if self.returncode is None:61 if self.returncode is None:
59 self.communicate()62 self.communicate()
6063
=== modified file 'lib/fixtures/tests/_fixtures/test_popen.py'
--- lib/fixtures/tests/_fixtures/test_popen.py 2014-08-19 04:44:18 +0000
+++ lib/fixtures/tests/_fixtures/test_popen.py 2014-08-19 04:44:18 +0000
@@ -94,3 +94,7 @@
94 proc = FakeProcess({}, {'stdout': BytesIO(_b('foo'))})94 proc = FakeProcess({}, {'stdout': BytesIO(_b('foo'))})
95 self.assertEqual((_b('foo'), ''), proc.communicate())95 self.assertEqual((_b('foo'), ''), proc.communicate())
96 self.assertEqual(0, proc.returncode)96 self.assertEqual(0, proc.returncode)
97
98 def test_kill(self):
99 proc = FakeProcess({}, {})
100 self.assertIs(None, proc.kill())

Subscribers

People subscribed via source and target branches