Пример #1
0
def db(test_app, request):
    """initialize the entries table and drop it when finished"""
    init_db()

    def cleanup():
        clear_db()
    request.addfinalizer(cleanup)
Пример #2
0
def db(test_app, request):
    """initialize the entries table and drop it when finished"""
    init_db()

    def cleanup():
        clear_db()

    request.addfinalizer(cleanup)
Пример #3
0
def test_app():
    """configure our app for use in testing"""
    app.config['DATABASE'] = TEST_DSN
    app.config['TESTING'] = True
    init_db()

    with app.test_request_context('/'):
        app.test_client().post(
            '/add', data=lettuce.world.entry_data, follow_redirects=True)
        # manually commit transaction here to avoid rollback
        # due to handled Exception
        get_database_connection().commit()
Пример #4
0
def test_app():
    """configure our app for use in testing"""
    app.config['DATABASE'] = TEST_DSN
    app.config['TESTING'] = True
    init_db()

    with app.test_request_context('/'):
        app.test_client().post('/add',
                               data=lettuce.world.entry_data,
                               follow_redirects=True)
        # manually commit transaction here to avoid rollback
        # due to handled Exception
        get_database_connection().commit()
Пример #5
0
def db(test_app, request):

    ''' Initialize the entries table and drop it when finished. '''

    # This is the "fixture function" with its "registered fixture" parameters.
    # The request parameter is a fixture that pytest gives you; you use it
    # to connect the cleanup() function to the db fixture.

    init_db()

    # Unexplained methods: cleardb addfinalizer cleanup

    # "The request parameter is a fixture that pytest registers.
    # You use it to connect the cleanup function to the db fixture.
    # This means that cleanup will be run after tests are complete
    # as a tear-down action."
    def cleanup():
        clear_db()

    # I THINK @app.teardown_request is a finalizer? Maaaaybe... ???
    request.addfinalizer(cleanup)
Пример #6
0
def configure_app_and_db():
    """configure our app for use in testing"""
    app.config['DATABASE'] = TEST_DSN
    app.config['TESTING'] = True
    """initialize the entries table and drop it when finished"""
    init_db()
Пример #7
0
def setup_app():
    print "Database  initialized."
    app.config['DATABASE'] = TEST_DSN
    app.config['TESTING'] = True

    init_db()
Пример #8
0
def setup_app():
    print "Database  initialized."
    app.config['DATABASE'] = TEST_DSN
    app.config['TESTING'] = True

    init_db()
Пример #9
0
def setup_app():
    app.config['DATABASE'] = TEST_DSN
    app.config['TESTING'] = True
    init_db()
Пример #10
0
def setup_app():
    print "This happens before all the lettuce tests begin"
    app.config['DATABASE'] = TEST_DSN
    app.config['TESTING'] = True

    init_db()
Пример #11
0
def setup_app():
    app.config['DATABASE'] = TEST_DSN
    app.config['TESTING'] = True
    init_db()
Пример #12
0
def db(test_app, request):
	init_db()

	def cleanup():
		clear_db()
	request.addfinalizer(cleanup)