def setUp(self): self.patch = mock.patch.object(builtins, 'open', mock.mock_open(read_data=_TEST_FILE)) self.patch.start() program_stats = runtime_profile.RuntimeProfile('foo.py').run() stats_handler = functools.partial(stats_server.StatsHandler, program_stats) self.server = stats_server.StatsServer((_HOST, _PORT), stats_handler) threading.Thread(target=self.server.serve_forever).start()
def setUp(self): program_stats = runtime_profile.RuntimeProfile(_PACKAGE_NAME).run() stats_handler = functools.partial(stats_server.StatsHandler, program_stats) self.server = stats_server.StatsServer((_HOST, _PORT), stats_handler) threading.Thread(target=self.server.serve_forever).start()