def tearDown(self): """ reset graphitesend """ # Drop any connections or modules that have been setup from other tests graphitesend.reset() try: self.server.shutdown(socket.SHUT_RD) self.server.close() except Exception: pass self.server = None
def setUp(self): """ reset graphitesend """ # Drop any connections or modules that have been setup from other tests graphitesend.reset() graphitesend.default_graphite_server = "localhost" self.hostname = os.uname()[1] self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.server.bind(("localhost", 2003)) self.server.listen(5)
def setUp(self): """ reset graphitesend """ # Drop any connections or modules that have been setup from other tests graphitesend.reset() graphitesend.default_graphite_server = 'localhost' self.hostname = os.uname()[1] self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.server.bind(('localhost', 2003)) self.server.listen(5)
def setUp(self): """ reset graphitesend """ # Drop any connections or modules that have been setup from other tests graphitesend.reset() # Monkeypatch the graphitesend so that it points at a graphite service # running on one of my ([email protected]) systems. # graphitesend.default_graphite_server = 'graphite.dansysadm.com' graphitesend.default_graphite_server = 'localhost' self.hostname = os.uname()[1] self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.server.bind(('localhost', 2003)) self.server.listen(5)
def test_reset(self): graphitesend.init() graphitesend.reset() graphite_instance = graphitesend._module_instance self.assertEqual(graphite_instance, None)