Turbogears2 migration: test suite

Thomas De Schampheleire patrickdepinguin at gmail.com
Fri Feb 19 21:20:36 UTC 2016


Hi Alessandro,

One of the next steps in the migration to Turbogears2 is to allow
running the test suite. Currently the test initialization code has
some pylons specifics which I don't understand (and thus fail to
convert to a Turbogears equivalent).

Essentially, the setup code in TestController is:

        self.wsgiapp = pylons.test.pylonsapp
        init_stack(self.wsgiapp.config)
        self.app = TestApp(self.wsgiapp)

with init_stack being:

def init_stack(config=None):
    if not config:
        config = pylons.test.pylonsapp.config
    url._push_object(URLGenerator(config['routes.map'], environ))
    pylons.app_globals._push_object(config['pylons.app_globals'])
    pylons.config._push_object(config)
    pylons.tmpl_context._push_object(ContextObj())
    # Initialize a translator for tests that utilize i18n
    translator = _get_translator(pylons.config.get('lang'))
    pylons.translator._push_object(translator)
    h = NullHandler()
    logging.getLogger("kallithea").addHandler(h)


Could you give some directions on how this should be changed?

As you may be aware, Kallithea is no longer using nose as test suite,
but pytest. This doesn't impact the setup of the app, but if you look
in kallithea/tests/__init__.py you'll see some apparently overly
complex classes, but they should be temporary as long as we have not
converted all tests from unittest-style to pytest-style. To run the
test suite, in any case there is one command 'py.test' to run,
'nosetests' support has been removed.


Thanks,
Thomas


More information about the kallithea-general mailing list