diff options
| author | Michael Merickel <michael@merickel.org> | 2016-08-31 03:50:44 -0500 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2016-08-31 03:58:50 -0500 |
| commit | 08ff26c443ef95078ab347eb79dc4666a17075dd (patch) | |
| tree | 83979ff7e2e5a6d3b63d1d705f113d81b47f92a8 | |
| parent | 2cb7e099ea67d4f6ef490785c6e777e5fa9ec334 (diff) | |
| download | pyramid-08ff26c443ef95078ab347eb79dc4666a17075dd.tar.gz pyramid-08ff26c443ef95078ab347eb79dc4666a17075dd.tar.bz2 pyramid-08ff26c443ef95078ab347eb79dc4666a17075dd.zip | |
add extra tests for testing action discriminators across orders
| -rw-r--r-- | pyramid/tests/test_config/test_init.py | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/pyramid/tests/test_config/test_init.py b/pyramid/tests/test_config/test_init.py index 67c2905d8..7e1a856cf 100644 --- a/pyramid/tests/test_config/test_init.py +++ b/pyramid/tests/test_config/test_init.py @@ -1595,6 +1595,28 @@ class TestActionState(unittest.TestCase): (3, g, (8,)), ]) + def test_executing_conflicting_action_across_orders(self): + from pyramid.exceptions import ConfigurationConflictError + c = self._makeOne() + def f(*a, **k): pass + def g(*a, **k): pass + c.actions = [ + (1, f, (1,), {}, (), None, -1), + (1, g, (2,)), + ] + self.assertRaises(ConfigurationConflictError, c.execute_actions) + + def test_executing_conflicting_action_across_reentrant_orders(self): + from pyramid.exceptions import ConfigurationConflictError + c = self._makeOne() + def f(*a, **k): + c.actions.append((1, g, (8,))) + def g(*a, **k): pass + c.actions = [ + (1, f, (1,), {}, (), None, -1), + ] + self.assertRaises(ConfigurationConflictError, c.execute_actions) + class Test_reentrant_action_functional(unittest.TestCase): def _makeConfigurator(self, *arg, **kw): from pyramid.config import Configurator @@ -1852,7 +1874,32 @@ class Test_resolveConflicts(unittest.TestCase): 'order': 99999} ] ) - + + def test_override_success_across_orders(self): + from pyramid.tests.test_config import dummyfactory as f + result = self._callFUT([ + (1, f, (2,), {}, ('x',), 'eek', 0), + (1, f, (3,), {}, ('x', 'y'), 'ack', 10), + ]) + result = list(result) + self.assertEqual(result, [ + {'info': 'eek', + 'args': (2,), + 'callable': f, + 'introspectables': (), + 'kw': {}, + 'discriminator': 1, + 'includepath': ('x',), + 'order': 0}, + ]) + + def test_conflicts_across_orders(self): + from pyramid.tests.test_config import dummyfactory as f + result = self._callFUT([ + (1, f, (2,), {}, ('x', 'y'), 'eek', 0), + (1, f, (3,), {}, ('x'), 'ack', 10), + ]) + self.assertRaises(ConfigurationConflictError, list, result) class TestGlobalRegistriesIntegration(unittest.TestCase): def setUp(self): |
