Skip to content

Instantly share code, notes, and snippets.

@dkuebric
Created May 3, 2012 22:23
Show Gist options
  • Save dkuebric/2589976 to your computer and use it in GitHub Desktop.
Save dkuebric/2589976 to your computer and use it in GitHub Desktop.
testing foresight
(venv)dan@dev1:~/code/oboe/test[master]$ cat !$
cat test_python.py
""" Tests for Python high-level API.
No stack needed!
"""
from test import TestWebInstrumentation
from udplisten import get_events, get_trace, get_events_and_response
import oboe
import time
from oboeware import loader
class TestPython(TestWebInstrumentation):
def __init__(self, *args, **kwargs):
TestWebInstrumentation.__init__(self, *args, **kwargs)
loader.load_inst_modules()
def test_normal(self):
oboe.config['tracing_mode'] = 'always'
oboe.config['sample_rate'] = 1.0
@oboe.Context.trace('test_normal')
def do_something():
time.sleep(0.1)
events = self.get_events(do_something, 2)
self.assertEquals(len(events), 2)
self.assert_standard_trace(events)
self.assertTrue('test_normal' in self.get_layer_names(events))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment