Example #1
0
    def create_app(self):
        from server.rest_server import TestingConfig, create_application
        import logging.handlers

        self.__app, self.__db = create_application(TestingConfig, log_filename=None)

        # Replaces all current logger handlers by our test (in memory) handler
        self.__log_handler = logging.handlers.BufferingHandler(100)
        del self.__app.logger.handlers[:]
        self.__app.logger.addHandler(self.__log_handler)

        return self.__app
Example #2
0
import os
import unittest
import coverage

from flask.ext.script import Manager

COV = coverage.coverage(branch=True,
                        include='server/*',
                        omit=['*/__init__.py', '*/config/*'])
COV.start()

from server.rest_server import DevelopmentConfig, create_application
app, db = create_application(DevelopmentConfig)

manager = Manager(app)


@manager.command
def test():
    """Runs the unit tests without coverage."""
    tests = unittest.TestLoader().discover('server')
    result = unittest.TextTestRunner(verbosity=2).run(tests)
    if result.wasSuccessful():
        return 0
    else:
        return 1


@manager.command
def cov():
    """Runs the unit tests with coverage."""
Example #3
0
import os
import unittest
import coverage

from flask.ext.script import Manager

COV = coverage.coverage(branch=True, include="server/*", omit=["*/__init__.py", "*/config/*"])
COV.start()

from server.rest_server import DevelopmentConfig, create_application

app, db = create_application(DevelopmentConfig)

manager = Manager(app)


@manager.command
def test():
    """Runs the unit tests without coverage."""
    tests = unittest.TestLoader().discover("server")
    result = unittest.TextTestRunner(verbosity=2).run(tests)
    if result.wasSuccessful():
        return 0
    else:
        return 1


@manager.command
def cov():
    """Runs the unit tests with coverage."""
    tests = unittest.TestLoader().discover("server")