Based entirely on - studio-ousia/gevent-statsd-moc with python-statsd dependency changed to pystatsd and gevent.server.DatagramServer used to handle the server portion
$ pip install mock-statdIn this sample we use pystatsd for client library
>>> from statsdmock import StatsdMockServer
>>> server = StatsdMockServer()
>>> server.start()
>>> import statsd
>>> c = statsd.StatsClient(prefix='bigtag')
>>> c.gauge('subtag', 10)
>>> server.wait('bigtag.subtag', n=1)
>>> data = list(server.metrics['bigtag.subtag'])
>>> assert data[0] == {'value': '10', 'type': 'gauge', 'rate': 1.0, 'timestamp': None}
>>> server.stop()
>>> del server