summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-08-03 08:26:47 +0000
committerLars Wirzenius <liw@liw.fi>2014-08-03 08:26:47 +0000
commit3fa45e962da74b20efa1bd98fe1482bb3be295ce (patch)
treee9d03557349fd19f079608c9d8764dd24f25a9d2
parentf846d8c4628dcd87e4afee551f5dd8644f1e8a56 (diff)
downloadcliapp-3fa45e962da74b20efa1bd98fe1482bb3be295ce.tar.gz
Fix test for callbacks
-rw-r--r--cliapp/runcmd_tests.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/cliapp/runcmd_tests.py b/cliapp/runcmd_tests.py
index 3346830..fff54ad 100644
--- a/cliapp/runcmd_tests.py
+++ b/cliapp/runcmd_tests.py
@@ -154,9 +154,14 @@ class RuncmdTests(unittest.TestCase):
exit, out, err = cliapp.runcmd_unchecked(['ls', 'nosuchthing'],
stderr_callback=logger)
- self.assertEqual(len(msgs), 1)
+ # The callback may be called several times, and we have no
+ # control over that: output from the subprocess may arrive in
+ # drips due to process scheduling and other reasons beyond our
+ # control. Thus, we compare the joined string fragments,
+ # instead of the list of fragments.
+
self.assertNotEqual(err, '')
- self.assertEqual(err, msgs[0])
+ self.assertEqual(''.join(msgs), err)
class ShellQuoteTests(unittest.TestCase):