Beispiel #1
0
  def test_find_root_thrifts(self):
    with temporary_dir() as dir:
      root_1 = self.write(os.path.join(dir, 'root_1.thrift'), '# noop')
      root_2 = self.write(os.path.join(dir, 'root_2.thrift'), '# noop')
      self.assertEquals({root_1, root_2},
                        find_root_thrifts(basedirs=[], sources=[root_1, root_2]))

    with temporary_dir() as dir:
      root_1 = self.write(os.path.join(dir, 'root_1.thrift'), 'include "mid_1.thrift"')
      self.write(os.path.join(dir, 'mid_1.thrift'), 'include "leaf_1.thrift"')
      self.write(os.path.join(dir, 'leaf_1.thrift'), '# noop')
      root_2 = self.write(os.path.join(dir, 'root_2.thrift'), 'include "root_1.thrift"')
      self.assertEquals({root_2}, find_root_thrifts(basedirs=[], sources=[root_1, root_2]))
Beispiel #2
0
    def test_find_root_thrifts(self):
        with temporary_dir() as dir:
            root_1 = self.write(os.path.join(dir, 'root_1.thrift'), '# noop')
            root_2 = self.write(os.path.join(dir, 'root_2.thrift'), '# noop')
            self.assertEquals({root_1, root_2},
                              find_root_thrifts(basedirs=[],
                                                sources=[root_1, root_2]))

        with temporary_dir() as dir:
            root_1 = self.write(os.path.join(dir, 'root_1.thrift'),
                                'include "mid_1.thrift"')
            self.write(os.path.join(dir, 'mid_1.thrift'),
                       'include "leaf_1.thrift"')
            self.write(os.path.join(dir, 'leaf_1.thrift'), '# noop')
            root_2 = self.write(os.path.join(dir, 'root_2.thrift'),
                                'include "root_1.thrift"')
            self.assertEquals({root_2},
                              find_root_thrifts(basedirs=[],
                                                sources=[root_1, root_2]))