How to use the birdseye.eye.db function in birdseye

To help you get started, we’ve selected a few birdseye examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alexmojaki / snoop / tests / samples / spy.py View on Github external
def main():
    for func in [foo, bar]:
        func()
        call_id = eye._last_call_id
        with eye.db.session_scope() as session:
            call = session.query(eye.db.Call).filter_by(id=call_id).one()
            assert call.result == '10'
github alexmojaki / snoop / tests / samples / spy.py View on Github external
def main():
    for func in [foo, bar]:
        func()
        call_id = eye._last_call_id
        with eye.db.session_scope() as session:
            call = session.query(eye.db.Call).filter_by(id=call_id).one()
            assert call.result == '10'
github alexmojaki / birdseye / tests / test_birdseye.py View on Github external
@eye.db.provide_session
def get_call_stuff(sess, c_id):
    call = sess.query(Call).filter_by(id=c_id).one()

    # <pre> makes it preserve whitespace
    soup = BeautifulSoup('<pre>' + call.function.html_body + '</pre>', 'html.parser')

    call_data = normalise_call_data(call.data)
    func_data = json.loads(call.function.data)
    return CallStuff(copy(call), soup, call_data, func_data)
</pre>
github alexmojaki / birdseye / tests / test_birdseye.py View on Github external
from unittest import skipUnless

from bs4 import BeautifulSoup
from cheap_repr import register_repr
from littleutils import json_to_file, file_to_json, string_to_file, only

import tests
from tests.utils import SharedCounter

str(tests)
from birdseye import eye
from birdseye.bird import NodeValue, is_interesting_expression, is_obvious_builtin
from birdseye.utils import PY2, PY3

Session = eye.db.Session
Call = eye.db.Call


@eye
def bar():
    pass


@eye()
def foo():
    x = 1
    y = 2
    if x + y > 5:
        1 / 0
    else:
        x * y
    try:
github alexmojaki / birdseye / tests / test_birdseye.py View on Github external
from time import sleep
from unittest import skipUnless

from bs4 import BeautifulSoup
from cheap_repr import register_repr
from littleutils import json_to_file, file_to_json, string_to_file, only

import tests
from tests.utils import SharedCounter

str(tests)
from birdseye import eye
from birdseye.bird import NodeValue, is_interesting_expression, is_obvious_builtin
from birdseye.utils import PY2, PY3

Session = eye.db.Session
Call = eye.db.Call


@eye
def bar():
    pass


@eye()
def foo():
    x = 1
    y = 2
    if x + y > 5:
        1 / 0
    else:
        x * y