diff options
| author | Chris McDonough <chrism@plope.com> | 2014-05-12 19:17:02 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2014-05-12 19:17:02 -0400 |
| commit | a978083b5719faf13e2ccf98ae93d5b03ec0d7cb (patch) | |
| tree | a1ffe16937711d514433bce8e2112aea0a8321d5 | |
| parent | 50d2b85e5e2795c2b129a86e8d388909fbc2835f (diff) | |
| parent | 8b8b05fd60948d18be7428f2bedac2c9fc6cd2f6 (diff) | |
| download | pyramid-a978083b5719faf13e2ccf98ae93d5b03ec0d7cb.tar.gz pyramid-a978083b5719faf13e2ccf98ae93d5b03ec0d7cb.tar.bz2 pyramid-a978083b5719faf13e2ccf98ae93d5b03ec0d7cb.zip | |
Merge branch 'master' of github.com:Pylons/pyramid
| -rw-r--r-- | CHANGES.txt | 8 | ||||
| -rw-r--r-- | CONTRIBUTORS.txt | 2 | ||||
| -rw-r--r-- | docs/narr/MyProject/myproject/templates/mytemplate.pt | 2 | ||||
| -rw-r--r-- | pyramid/scaffolds/alchemy/+package+/templates/mytemplate.pt_tmpl | 2 | ||||
| -rw-r--r-- | pyramid/scaffolds/starter/+package+/templates/mytemplate.pt_tmpl | 2 | ||||
| -rw-r--r-- | pyramid/scaffolds/zodb/+package+/templates/mytemplate.pt_tmpl | 2 | ||||
| -rw-r--r-- | pyramid/testing.py | 20 | ||||
| -rw-r--r-- | pyramid/tests/test_testing.py | 5 |
8 files changed, 36 insertions, 7 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 2b80e87e2..0c461e550 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -12,6 +12,11 @@ Bug Fixes add_route_predicate for example can not take a string and turn it into the actual callable function. +- Fix ``pyramid.testing.setUp`` to return a ``Configurator`` with a proper + package. Previously it was not possible to do package-relative includes + using the returned ``Configurator`` during testing. There is now a + ``package`` argument that can override this behavior as well. + Docs ---- @@ -30,6 +35,9 @@ Scaffolds templates to have links to correctly versioned documentation and reflect which pyramid was used to generate the scaffold. +- Removed non-ascii copyright symbol from templates, as this was + causing the scaffolds to fail for project generation. + 1.5 (2014-04-08) ================ diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index d1ac72df5..c77d3e92c 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -230,3 +230,5 @@ Contributors - Antti Haapala, 2013/11/15 - Amit Mane, 2014/01/23 + +- Fenton Travers, 2014/05/06 diff --git a/docs/narr/MyProject/myproject/templates/mytemplate.pt b/docs/narr/MyProject/myproject/templates/mytemplate.pt index d1af4f42c..e6b00a145 100644 --- a/docs/narr/MyProject/myproject/templates/mytemplate.pt +++ b/docs/narr/MyProject/myproject/templates/mytemplate.pt @@ -50,7 +50,7 @@ </div> <div class="row"> <div class="copyright"> - Copyright © Pylons Project + Copyright © Pylons Project </div> </div> </div> diff --git a/pyramid/scaffolds/alchemy/+package+/templates/mytemplate.pt_tmpl b/pyramid/scaffolds/alchemy/+package+/templates/mytemplate.pt_tmpl index 976011ecb..73d0976b9 100644 --- a/pyramid/scaffolds/alchemy/+package+/templates/mytemplate.pt_tmpl +++ b/pyramid/scaffolds/alchemy/+package+/templates/mytemplate.pt_tmpl @@ -50,7 +50,7 @@ </div> <div class="row"> <div class="copyright"> - Copyright © Pylons Project + Copyright © Pylons Project </div> </div> </div> diff --git a/pyramid/scaffolds/starter/+package+/templates/mytemplate.pt_tmpl b/pyramid/scaffolds/starter/+package+/templates/mytemplate.pt_tmpl index 3c27906a0..738a16817 100644 --- a/pyramid/scaffolds/starter/+package+/templates/mytemplate.pt_tmpl +++ b/pyramid/scaffolds/starter/+package+/templates/mytemplate.pt_tmpl @@ -50,7 +50,7 @@ </div> <div class="row"> <div class="copyright"> - Copyright © Pylons Project + Copyright © Pylons Project </div> </div> </div> diff --git a/pyramid/scaffolds/zodb/+package+/templates/mytemplate.pt_tmpl b/pyramid/scaffolds/zodb/+package+/templates/mytemplate.pt_tmpl index 56efda8b4..855944899 100644 --- a/pyramid/scaffolds/zodb/+package+/templates/mytemplate.pt_tmpl +++ b/pyramid/scaffolds/zodb/+package+/templates/mytemplate.pt_tmpl @@ -50,7 +50,7 @@ </div> <div class="row"> <div class="copyright"> - Copyright © Pylons Project + Copyright © Pylons Project </div> </div> </div> diff --git a/pyramid/testing.py b/pyramid/testing.py index 91dc41dd5..8cbd8b82b 100644 --- a/pyramid/testing.py +++ b/pyramid/testing.py @@ -21,6 +21,7 @@ from pyramid.compat import ( from pyramid.config import Configurator from pyramid.decorator import reify +from pyramid.path import caller_package from pyramid.response import Response from pyramid.registry import Registry @@ -388,7 +389,7 @@ class DummyRequest( have_zca = True def setUp(registry=None, request=None, hook_zca=True, autocommit=True, - settings=None): + settings=None, package=None): """ Set :app:`Pyramid` registry and request thread locals for the duration of a single unit test. @@ -432,9 +433,15 @@ def setUp(registry=None, request=None, hook_zca=True, autocommit=True, :mod:`zope.component` package cannot be imported, or if ``hook_zca`` is ``False``, the hook will not be set. - If ``settings`` is not None, it must be a dictionary representing the + If ``settings`` is not ``None``, it must be a dictionary representing the values passed to a Configurator as its ``settings=`` argument. + If ``package`` is ``None`` it will be set to the caller's package. The + ``package`` setting in the :class:`pyramid.config.Configurator` will + affect any relative imports made via + :meth:`pyramid.config.Configurator.include` or + :meth:`pyramid.config.Configurator.maybe_dotted`. + This function returns an instance of the :class:`pyramid.config.Configurator` class, which can be used for further configuration to set up an environment suitable @@ -447,7 +454,10 @@ def setUp(registry=None, request=None, hook_zca=True, autocommit=True, manager.clear() if registry is None: registry = Registry('testing') - config = Configurator(registry=registry, autocommit=autocommit) + if package is None: + package = caller_package() + config = Configurator(registry=registry, autocommit=autocommit, + package=package) if settings is None: settings = {} if getattr(registry, 'settings', None) is None: @@ -505,6 +515,10 @@ def tearDown(unhook_zca=True): def cleanUp(*arg, **kw): """ An alias for :func:`pyramid.testing.setUp`. """ + package = kw.get('package', None) + if package is None: + package = caller_package() + kw['package'] = package return setUp(*arg, **kw) class DummyRendererFactory(object): diff --git a/pyramid/tests/test_testing.py b/pyramid/tests/test_testing.py index da57c6301..2d0548b33 100644 --- a/pyramid/tests/test_testing.py +++ b/pyramid/tests/test_testing.py @@ -347,6 +347,7 @@ class Test_setUp(unittest.TestCase): self.assertEqual(config.registry, current['registry']) self.assertEqual(current['registry'].__class__, Registry) self.assertEqual(current['request'], None) + self.assertEqual(config.package.__name__, 'pyramid.tests') self._assertSMHook(get_current_registry) def test_it_with_registry(self): @@ -364,6 +365,10 @@ class Test_setUp(unittest.TestCase): current = manager.get() self.assertEqual(current['request'], request) + def test_it_with_package(self): + config = self._callFUT(package='pyramid') + self.assertEqual(config.package.__name__, 'pyramid') + def test_it_with_hook_zca_false(self): from pyramid.registry import Registry registry = Registry() |
