Skip to content

Instantly share code, notes, and snippets.

@piotr-dobrogost
Created October 29, 2015 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piotr-dobrogost/5a464f6c6a7dc362115b to your computer and use it in GitHub Desktop.
Save piotr-dobrogost/5a464f6c6a7dc362115b to your computer and use it in GitHub Desktop.
Test for difference in .add_translation_dirs() with and without .commit()
(pyramid)[piotr@demon pyramid]$ nosetests -t test_xxx
E
======================================================================
ERROR: test_xxx (pyramid.tests.test_config.test_i18n.TestI18NConfiguratorMixin)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/piotr/projects/pyramid/pyramid/tests/test_config/test_i18n.py", line 95, in test_xxx
dirs = config.registry.getUtility(ITranslationDirectories)
File "/home/piotr/.virtualenvs/pyramid/lib/python2.7/site-packages/zope/interface/registry.py", line 172, in getUtility
raise ComponentLookupError(provided, name)
ComponentLookupError: (<InterfaceClass pyramid.interfaces.ITranslationDirectories>, u'')
----------------------------------------------------------------------
Ran 1 test in 0.015s
FAILED (errors=1)
# def test_add_translation_dirs_abspath(self):
# from pyramid.interfaces import ITranslationDirectories
# config = self._makeOne(autocommit=True)
# config.add_translation_dirs(locale)
# self.assertEqual(config.registry.getUtility(ITranslationDirectories),
# [locale])
def test_xxx(self):
from pyramid.interfaces import ITranslationDirectories
config = self._makeOne()
config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale')
dirs = config.registry.getUtility(ITranslationDirectories)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment