Skip to content

Commit

Permalink
Fix test_multiple_source_roots, ignore ordering.
Browse files Browse the repository at this point in the history
The `test_multiple_source_root` test failed on my machine.  Although the
langs list in each line is sorted by the `ListRoots` task, the roots
themselves are emitted in no particular order.

Also leverage `ConsoleTaskTestBase.assert_console_output` in favor of
the custom output testing infra the test was using.

Testing Done:
CI went green here:
  https://travis-ci.org/pantsbuild/pants/builds/89705302

Bugs closed: 2511

Reviewed at https://rbcommons.com/s/twitter/r/3089/
  • Loading branch information
jsirois committed Nov 6, 2015
1 parent 5d14bb1 commit add4512
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tests/python/pants_test/tasks/test_roots.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,18 @@ def _add_source_root(self, source_root_config, path, langs):
os.makedirs(os.path.join(get_buildroot(), path))
source_root_config.get_source_roots().add_source_root(path, langs)

def _assert_output(self, expected):
self.assertEqual(expected, self.execute_console_task())

def test_no_langs(self):
with subsystem_instance(SourceRootConfig) as source_root_config:
self._add_source_root(source_root_config, 'fakeroot', tuple())
self._assert_output(['fakeroot: *'])
self.assert_console_output('fakeroot: *')

def test_single_source_root(self):
with subsystem_instance(SourceRootConfig) as source_root_config:
self._add_source_root(source_root_config, 'fakeroot', ('lang1', 'lang2'))
self._assert_output(['fakeroot: lang1,lang2'])
self.assert_console_output('fakeroot: lang1,lang2')

def test_multiple_source_root(self):
def test_multiple_source_roots(self):
with subsystem_instance(SourceRootConfig) as source_root_config:
self._add_source_root(source_root_config, 'fakerootA', ('lang1',))
self._add_source_root(source_root_config, 'fakerootB', ('lang2',))
self._assert_output(['fakerootA: lang1', 'fakerootB: lang2'])
self.assert_console_output('fakerootA: lang1', 'fakerootB: lang2')

0 comments on commit add4512

Please sign in to comment.