diff options
| author | Michael Merickel <michael@merickel.org> | 2011-08-16 03:09:34 -0500 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2011-08-16 03:22:20 -0500 |
| commit | 6007dd9a6a22e1112afa6a72ca2ee406698d775f (patch) | |
| tree | 614eea9b47ff983076dc7927aa7bac627f4ad61f | |
| parent | 8a455dbc824393899fd465f6816091f789eb7e1d (diff) | |
| download | pyramid-6007dd9a6a22e1112afa6a72ca2ee406698d775f.tar.gz pyramid-6007dd9a6a22e1112afa6a72ca2ee406698d775f.tar.bz2 pyramid-6007dd9a6a22e1112afa6a72ca2ee406698d775f.zip | |
Added tests for module without __all__.
| -rw-r--r-- | pyramid/tests/pshellapp/__init__.py | 7 | ||||
| -rw-r--r-- | pyramid/tests/pshellapp/no_all.py | 5 | ||||
| -rw-r--r-- | pyramid/tests/pshellapp/with_all.py | 7 | ||||
| -rw-r--r-- | pyramid/tests/test_paster.py | 33 |
4 files changed, 39 insertions, 13 deletions
diff --git a/pyramid/tests/pshellapp/__init__.py b/pyramid/tests/pshellapp/__init__.py index dd0a3e2f9..e69de29bb 100644 --- a/pyramid/tests/pshellapp/__init__.py +++ b/pyramid/tests/pshellapp/__init__.py @@ -1,7 +0,0 @@ -__all__ = ['a', 'root', 'm'] - -a = 1 -b = 2 - -root = 'root override' -m = 'model override' diff --git a/pyramid/tests/pshellapp/no_all.py b/pyramid/tests/pshellapp/no_all.py new file mode 100644 index 000000000..177a34590 --- /dev/null +++ b/pyramid/tests/pshellapp/no_all.py @@ -0,0 +1,5 @@ +a = 1 +b = 2 + +root = 'root override' +m = 'model override' diff --git a/pyramid/tests/pshellapp/with_all.py b/pyramid/tests/pshellapp/with_all.py new file mode 100644 index 000000000..dd0a3e2f9 --- /dev/null +++ b/pyramid/tests/pshellapp/with_all.py @@ -0,0 +1,7 @@ +__all__ = ['a', 'root', 'm'] + +a = 1 +b = 2 + +root = 'root override' +m = 'model override' diff --git a/pyramid/tests/test_paster.py b/pyramid/tests/test_paster.py index cb30dcc12..49a54aecc 100644 --- a/pyramid/tests/test_paster.py +++ b/pyramid/tests/test_paster.py @@ -157,9 +157,10 @@ class TestPShellCommand(unittest.TestCase): self.assertTrue(self.bootstrap.closer.called) self.assertTrue(shell.help) - def test_command_loads_use_script(self): + def test_command_loads_use_script_with_all(self): command = self._makeOne() - self.config_factory.items = [('import', 'pyramid.tests.pshellapp')] + self.config_factory.items = [ + ('import', 'pyramid.tests.pshellapp.with_all')] shell = DummyShell() command.command(shell) self.assertTrue(self.config_factory.parser) @@ -176,11 +177,31 @@ class TestPShellCommand(unittest.TestCase): self.assertTrue(self.bootstrap.closer.called) self.assertTrue(shell.help) - def test_command_loads_use_script_check_order(self): + def test_command_loads_use_script_without_all(self): + command = self._makeOne() + self.config_factory.items = [ + ('import', 'pyramid.tests.pshellapp.no_all')] + shell = DummyShell() + command.command(shell) + self.assertTrue(self.config_factory.parser) + self.assertEqual(self.config_factory.parser.filename, + '/foo/bar/myapp.ini') + self.assertEqual(self.bootstrap.a[0], '/foo/bar/myapp.ini#myapp') + self.assertEqual(shell.env, { + 'app':self.bootstrap.app, 'root':'root override', + 'registry':self.bootstrap.registry, + 'request':self.bootstrap.request, + 'root_factory':self.bootstrap.root_factory, + 'a': 1, 'b': 2, 'm': 'model override', + }) + self.assertTrue(self.bootstrap.closer.called) + self.assertTrue(shell.help) + + def test_command_loads_check_variable_override_order(self): command = self._makeOne() model = Dummy() - self.config_factory.items = [('import', 'pyramid.tests.pshellapp'), - ('m', model)] + self.config_factory.items = [ + ('import', 'pyramid.tests.pshellapp.with_all'), ('m', model)] shell = DummyShell() command.command(shell) self.assertTrue(self.config_factory.parser) @@ -202,7 +223,7 @@ class TestPShellCommand(unittest.TestCase): model = Dummy() self.config_factory.items = [('import', 'abc'), ('m', model)] - command.options.use_script = 'pyramid.tests.pshellapp' + command.options.use_script = 'pyramid.tests.pshellapp.with_all' shell = DummyShell() command.command(shell) self.assertTrue(self.config_factory.parser) |
