Пример #1
0
 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
 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
 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()
Пример #4
0
 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()
Пример #5
0
 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()
Пример #6
0
 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()