コード例 #1
0
ファイル: test_graph.py プロジェクト: ViDA-NYU/reprozip
 def do_dot_test(self, expected, **kwargs):
     graph.Process._id_gen = 0
     tmpdir = Path.tempdir(prefix='rpz_testgraph_')
     target = tmpdir / 'graph.dot'
     try:
         graph.generate(target,
                        self._trace / 'config.yml',
                        self._trace / 'trace.sqlite3',
                        **kwargs)
         if expected is False:
             self.fail("DOT generation didn't fail as expected")
         with target.open('r') as fp:
             self.assertEqual(expected, fp.read())
     except UsageError:
         if expected is not False:
             raise
     finally:
         tmpdir.rmtree()
コード例 #2
0
ファイル: test_graph.py プロジェクト: hugobowne/reprozip
 def do_dot_test(self, expected, **kwargs):
     graph.Process._id_gen = 0
     fd, target = Path.tempfile(prefix='rpz_testgraph_', suffix='.dot')
     os.close(fd)
     try:
         graph.generate(target,
                        self._trace / 'config.yml',
                        self._trace / 'trace.sqlite3',
                        **kwargs)
         if expected is False:
             self.fail("DOT generation didn't fail as expected")
         with target.open('r') as fp:
             self.assertEqual(expected, fp.read())
     except UsageError:
         if expected is not False:
             raise
     finally:
         target.remove()
コード例 #3
0
ファイル: test_graph.py プロジェクト: ViDA-NYU/reprozip
 def do_json_test(self, expected, **kwargs):
     graph.Process._id_gen = 0
     tmpdir = Path.tempdir(prefix='rpz_testgraph_')
     target = tmpdir / 'graph.json'
     try:
         graph.generate(target,
                        self._trace / 'config.yml',
                        self._trace / 'trace.sqlite3',
                        graph_format='json', **kwargs)
         if expected is False:
             self.fail("JSON generation didn't fail as expected")
         with target.open('r', encoding='utf-8') as fp:
             obj = json.load(fp)
         self.assertEqual(expected, obj)
     except SystemExit:
         if expected is not False:
             raise
     finally:
         tmpdir.rmtree()