summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2012-12-19 21:24:03 +1300
committerRobert Collins <robertc@robertcollins.net>2012-12-19 21:24:03 +1300
commit4ac5925b2a46e6d7d9804956d9edccccb2426ffb (patch)
tree721cb0ccb041d45ee772f4b5572b01d239369cfb
parentac5f26e5783037f616fa13cd116e183a780c0781 (diff)
downloadtestrepository-4ac5925b2a46e6d7d9804956d9edccccb2426ffb.tar.gz
Revert out a test tweak, and add test for behaviour without per-instance execution logic.
-rw-r--r--testrepository/testcommand.py5
-rw-r--r--testrepository/tests/test_testcommand.py17
2 files changed, 18 insertions, 4 deletions
diff --git a/testrepository/testcommand.py b/testrepository/testcommand.py
index 4db5f23..52aed71 100644
--- a/testrepository/testcommand.py
+++ b/testrepository/testcommand.py
@@ -346,7 +346,7 @@ class TestCommand(Fixture):
def setUp(self):
super(TestCommand, self).setUp()
- self._instances = set(['qwe'])
+ self._instances = set()
self.addCleanup(self._dispose_instances)
def _dispose_instances(self):
@@ -359,7 +359,8 @@ class TestCommand(Fixture):
except (ValueError, ConfigParser.NoOptionError):
return
variable_regex = '\$INSTANCE_IDS'
- dispose_cmd = re.sub(variable_regex, ' ' .join(instances), dispose_cmd)
+ dispose_cmd = re.sub(variable_regex, ' ' .join(sorted(instances)),
+ dispose_cmd)
self.ui.output_values([('running', dispose_cmd)])
run_proc = self.ui.subprocess_Popen(dispose_cmd, shell=True)
run_proc.communicate()
diff --git a/testrepository/tests/test_testcommand.py b/testrepository/tests/test_testcommand.py
index 3fd8e97..8539054 100644
--- a/testrepository/tests/test_testcommand.py
+++ b/testrepository/tests/test_testcommand.py
@@ -102,8 +102,8 @@ class TestTestCommand(ResourcedTestCase):
command.cleanUp()
command.setUp()
self.assertEqual([
- ('values', [('running', 'bar quux qwe baz')]),
- ('popen', ('bar quux qwe baz',), {'shell': True}),
+ ('values', [('running', 'bar baz quux')]),
+ ('popen', ('bar baz quux',), {'shell': True}),
('communicate',)], ui.outputs)
def test_TestCommand_cleanUp_disposes_instances_fail_raises(self):
@@ -281,6 +281,19 @@ class TestTestCommand(ResourcedTestCase):
self.assertEqual(1, len(partitions[0]))
self.assertEqual(1, len(partitions[1]))
+ def test_run_tests_with_instances(self):
+ # when there are instances and no instance_execute, run_tests acts as
+ # normal.
+ ui, command = self.get_test_ui_and_cmd()
+ self.set_config(
+ '[DEFAULT]\ntest_command=foo $IDLIST\n')
+ command._instances.update(['foo', 'bar'])
+ fixture = self.useFixture(command.get_run_command())
+ procs = fixture.run_tests()
+ self.assertEqual([
+ ('values', [('running', 'foo ')]),
+ ('popen', ('foo ',), {'shell': True, 'stdin': -1, 'stdout': -1})], ui.outputs)
+
def test_filter_tags_parsing(self):
ui, command = self.get_test_ui_and_cmd()
self.set_config('[DEFAULT]\nfilter_tags=foo bar\n')