def setUp(self): program_stats = memory_profile.MemoryProfile( _PACKAGE_PATH).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): self.patch = mock.patch.object(builtins, 'open', mock.mock_open(read_data=_TEST_FILE)) self.patch.start() program_stats = memory_profile.MemoryProfile('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()