예제 #1
0
파일: test_debug.py 프로젝트: ocni-dtu/maas
    def test_toggle_cprofile_profiles(self):
        def my_method():
            return 1

        toggle_cprofile("my-process")
        my_method()
        toggle_cprofile("my-process")
        prof_path = self._get_prof_path("my-process")
        output = io.StringIO()
        stats = pstats.Stats(str(prof_path), stream=output)
        stats.print_callers()
        self.assertIn("my_method", output.getvalue())
예제 #2
0
파일: test_debug.py 프로젝트: ocni-dtu/maas
 def test_toggle_cprofile_writes_file(self):
     toggle_cprofile("my-process")
     toggle_cprofile("my-process")
     self.assertTrue(self._get_prof_path("my-process").exists())