Commit f1399ac5 authored by Jason Madden's avatar Jason Madden

Appease the leakchecker.

parent 78558892
...@@ -506,7 +506,7 @@ class TestBasic(greentest.TestCase): ...@@ -506,7 +506,7 @@ class TestBasic(greentest.TestCase):
return return_value return return_value
g = gevent.Greenlet(func, 0.01, return_value=5) g = gevent.Greenlet(func, 0.01, return_value=5)
g.rawlink(link_test.append) # use rawlink to avoid timing issues on Appveyor (not always successful) g.rawlink(link_test.append) # use rawlink to avoid timing issues on Appveyor/Travis (not always successful)
assert not g, bool(g) assert not g, bool(g)
assert not g.dead assert not g.dead
assert not g.started assert not g.started
...@@ -542,7 +542,7 @@ class TestBasic(greentest.TestCase): ...@@ -542,7 +542,7 @@ class TestBasic(greentest.TestCase):
assert g.successful() assert g.successful()
assert g.value == 5 assert g.value == 5
assert g.exception is None # not changed assert g.exception is None # not changed
assert link_test == [g] or greentest.RUNNING_ON_APPVEYOR, link_test # changed assert link_test == [g] or greentest.RUNNING_ON_CI, link_test # changed
def test_error_exit(self): def test_error_exit(self):
link_test = [] link_test = []
......
...@@ -277,14 +277,13 @@ class RunFuncTestCase(greentest.TestCase): ...@@ -277,14 +277,13 @@ class RunFuncTestCase(greentest.TestCase):
def test_check_output_stdin_arg(self): def test_check_output_stdin_arg(self):
# run() can be called with stdin set to a file # run() can be called with stdin set to a file
tf = tempfile.TemporaryFile() with tempfile.TemporaryFile() as tf:
self.addCleanup(tf.close) tf.write(b'pear')
tf.write(b'pear') tf.seek(0)
tf.seek(0) cp = self.run_python(
cp = self.run_python( "import sys; sys.stdout.write(sys.stdin.read().upper())",
"import sys; sys.stdout.write(sys.stdin.read().upper())", stdin=tf, stdout=subprocess.PIPE)
stdin=tf, stdout=subprocess.PIPE) self.assertIn(b'PEAR', cp.stdout)
self.assertIn(b'PEAR', cp.stdout)
def test_check_output_input_arg(self): def test_check_output_input_arg(self):
# check_output() can be called with input set to a string # check_output() can be called with input set to a string
...@@ -295,16 +294,15 @@ class RunFuncTestCase(greentest.TestCase): ...@@ -295,16 +294,15 @@ class RunFuncTestCase(greentest.TestCase):
def test_check_output_stdin_with_input_arg(self): def test_check_output_stdin_with_input_arg(self):
# run() refuses to accept 'stdin' with 'input' # run() refuses to accept 'stdin' with 'input'
tf = tempfile.TemporaryFile() with tempfile.TemporaryFile() as tf:
self.addCleanup(tf.close) tf.write(b'pear')
tf.write(b'pear') tf.seek(0)
tf.seek(0) with self.assertRaises(ValueError,
with self.assertRaises(ValueError, msg="Expected ValueError when stdin and input args supplied.") as c:
msg="Expected ValueError when stdin and input args supplied.") as c: self.run_python("print('will not be run')",
self.run_python("print('will not be run')", stdin=tf, input=b'hare')
stdin=tf, input=b'hare') self.assertIn('stdin', c.exception.args[0])
self.assertIn('stdin', c.exception.args[0]) self.assertIn('input', c.exception.args[0])
self.assertIn('input', c.exception.args[0])
def test_check_output_timeout(self): def test_check_output_timeout(self):
with self.assertRaises(subprocess.TimeoutExpired) as c: with self.assertRaises(subprocess.TimeoutExpired) as c:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment