"""Tests for the test runner logic."""
-import StringIO
-
-from testtools.helpers import try_import
+from testtools.helpers import try_import, try_imports
fixtures = try_import('fixtures')
+StringIO = try_imports(['StringIO.StringIO', 'io.StringIO'])
import testtools
from testtools import TestCase, run
if fixtures is None:
self.skipTest("Need fixtures")
package = self.useFixture(SampleTestFixture())
- out = StringIO.StringIO()
+ out = StringIO()
run.main(['prog', '-l', 'testtools.runexample.test_suite'], out)
self.assertEqual("""testtools.runexample.TestFoo.test_bar
testtools.runexample.TestFoo.test_quux
if fixtures is None:
self.skipTest("Need fixtures")
package = self.useFixture(SampleTestFixture())
- out = StringIO.StringIO()
+ out = StringIO()
# We load two tests - one that exists and one that doesn't, and we
# should get the one that exists and neither the one that doesn't nor
# the unmentioned one that does.