summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-12-15 18:42:22 -0500
committerChris McDonough <chrism@plope.com>2011-12-15 18:42:22 -0500
commitd5861420e9d4c6a3c8b52955e9f28634a6811553 (patch)
tree6b585e759bf6c6d933527d09b6d996c4148af61b
parent954795d2d5c3fafb3b439904a577391cd96b5751 (diff)
downloadpyramid-d5861420e9d4c6a3c8b52955e9f28634a6811553.tar.gz
pyramid-d5861420e9d4c6a3c8b52955e9f28634a6811553.tar.bz2
pyramid-d5861420e9d4c6a3c8b52955e9f28634a6811553.zip
- Normalized exit values and ``-h`` output for all ``p*`` scripts
(``pviews``, ``proutes``, etc).
-rw-r--r--CHANGES.txt6
-rw-r--r--TODO.txt1
-rw-r--r--pyramid/scripts/pcreate.py19
-rw-r--r--pyramid/scripts/prequest.py8
-rw-r--r--pyramid/scripts/proutes.py31
-rw-r--r--pyramid/scripts/pserve.py19
-rw-r--r--pyramid/scripts/pshell.py42
-rw-r--r--pyramid/scripts/ptweens.py42
-rw-r--r--pyramid/scripts/pviews.py34
-rw-r--r--pyramid/tests/test_scripts/test_pcreate.py18
-rw-r--r--pyramid/tests/test_scripts/test_proutes.py16
-rw-r--r--pyramid/tests/test_scripts/test_pserve.py4
-rw-r--r--pyramid/tests/test_scripts/test_pshell.py2
-rw-r--r--pyramid/tests/test_scripts/test_ptweens.py8
-rw-r--r--pyramid/tests/test_scripts/test_pviews.py26
15 files changed, 142 insertions, 134 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index c8a156d2e..795824e0b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -8,6 +8,12 @@ Features
documented in the "Command-Line Pyramid" chapter in the section entitled
"Invoking a Request".
+Bug Fixes
+---------
+
+- Normalized exit values and ``-h`` output for all ``p*`` scripts
+ (``pviews``, ``proutes``, etc).
+
1.3a2 (2011-12-14)
==================
diff --git a/TODO.txt b/TODO.txt
index b0d6c95bc..a5ec323a3 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -22,6 +22,7 @@ Must-Have
- Fix deployment recipes in cookbook (discourage proxying without changing
server).
+- Allow prequest path to have query string variables.
Nice-to-Have
------------
diff --git a/pyramid/scripts/pcreate.py b/pyramid/scripts/pcreate.py
index 0057402b3..ba4eb0856 100644
--- a/pyramid/scripts/pcreate.py
+++ b/pyramid/scripts/pcreate.py
@@ -13,12 +13,13 @@ _bad_chars_re = re.compile('[^a-zA-Z0-9_]')
def main(argv=sys.argv, quiet=False):
command = PCreateCommand(argv, quiet)
- command.run()
+ return command.run()
class PCreateCommand(object):
- verbosity = 1
- usage = "usage: %prog [options] distribution_name"
- parser = optparse.OptionParser(usage)
+ verbosity = 1 # required
+ description = "Render Pyramid scaffolding to an output directory"
+ usage = "usage: %prog [options] output_directory"
+ parser = optparse.OptionParser(usage, description=description)
parser.add_option('-s', '--scaffold',
dest='scaffold_name',
action='append',
@@ -62,15 +63,15 @@ class PCreateCommand(object):
return self.show_scaffolds()
if not self.options.scaffold_name:
self.out('You must provide at least one scaffold name')
- return
+ return 2
if not self.args:
self.out('You must provide a project name')
- return
+ return 2
available = [x.name for x in self.scaffolds]
diff = set(self.options.scaffold_name).difference(available)
if diff:
self.out('Unavailable scaffolds: %s' % list(diff))
- return
+ return 2
return self.render_scaffolds()
def render_scaffolds(self):
@@ -90,7 +91,7 @@ class PCreateCommand(object):
for scaffold in self.scaffolds:
if scaffold.name == scaffold_name:
scaffold.run(self, output_dir, vars)
- return True
+ return 0
def show_scaffolds(self):
scaffolds = sorted(self.scaffolds, key=lambda x: x.name)
@@ -103,7 +104,7 @@ class PCreateCommand(object):
' '*(max_name-len(scaffold.name)), scaffold.summary))
else:
self.out('No scaffolds available')
- return True
+ return 0
def all_scaffolds(self):
scaffolds = []
diff --git a/pyramid/scripts/prequest.py b/pyramid/scripts/prequest.py
index 6a860c900..073323cd6 100644
--- a/pyramid/scripts/prequest.py
+++ b/pyramid/scripts/prequest.py
@@ -18,7 +18,7 @@ class PRequestCommand(object):
PasteDeploy (.ini) configuration file for the server and application.
Use "prequest config.ini /path" to request "/path". Use "prequest
- config.ini /path --method=post < data" to do a POST with the given
+ --method=POST config.ini /path < data" to do a POST with the given
request body.
If the path is relative (doesn't begin with "/") it is interpreted as
@@ -28,11 +28,11 @@ class PRequestCommand(object):
the request's WSGI environment, so your application can distinguish these
calls from normal requests.
- Note that you can pass options besides the options listed here; any
- unknown options will be passed to the application in
+ Note that you can pass arguments besides the options listed here; any
+ unknown arguments will be passed to the application in
"environ['QUERY_STRING']"
"""
- usage = "usage: %prog config_file path_info [args/options]"
+ usage = "usage: %prog config_uri path_info [args/options]"
parser = optparse.OptionParser(
usage=usage,
description=textwrap.dedent(description)
diff --git a/pyramid/scripts/proutes.py b/pyramid/scripts/proutes.py
index 570417e95..29ec9e72a 100644
--- a/pyramid/scripts/proutes.py
+++ b/pyramid/scripts/proutes.py
@@ -1,34 +1,34 @@
import optparse
import sys
+import textwrap
from pyramid.paster import bootstrap
def main(argv=sys.argv, quiet=False):
command = PRoutesCommand(argv, quiet)
- command.run()
+ return command.run()
class PRoutesCommand(object):
- """Print all URL dispatch routes used by a Pyramid application in the
+ description = """\
+ Print all URL dispatch routes used by a Pyramid application in the
order in which they are evaluated. Each route includes the name of the
route, the pattern of the route, and the view callable which will be
invoked when the route is matched.
- This command accepts one positional argument:
-
- ``config_uri`` -- specifies the PasteDeploy config file to use for the
- interactive shell. The format is ``inifile#name``. If the name is left
- off, ``main`` will be assumed.
-
- Example::
-
- $ proutes myapp.ini#main
+ This command accepts one positional argument named "config_uri". It
+ specifies the PasteDeploy config file to use for the interactive
+ shell. The format is "inifile#name". If the name is left off, "main"
+ will be assumed. Example: "proutes myapp.ini".
"""
bootstrap = (bootstrap,)
- summary = "Print all URL dispatch routes related to a Pyramid application"
stdout = sys.stdout
+ usage = '%prog config_uri'
- parser = optparse.OptionParser()
+ parser = optparse.OptionParser(
+ usage,
+ description=textwrap.dedent(description)
+ )
def __init__(self, argv, quiet=False):
self.options, self.args = self.parser.parse_args(argv[1:])
@@ -46,7 +46,7 @@ class PRoutesCommand(object):
def run(self, quiet=False):
if not self.args:
self.out('requires a config file argument')
- return
+ return 2
from pyramid.interfaces import IRouteRequest
from pyramid.interfaces import IViewClassifier
from pyramid.interfaces import IView
@@ -59,7 +59,7 @@ class PRoutesCommand(object):
routes = mapper.get_routes()
fmt = '%-15s %-30s %-25s'
if not routes:
- return
+ return 0
self.out(fmt % ('Name', 'Pattern', 'View'))
self.out(
fmt % ('-'*len('Name'), '-'*len('Pattern'), '-'*len('View')))
@@ -77,4 +77,5 @@ class PRoutesCommand(object):
(IViewClassifier, request_iface, Interface),
IView, name='', default=None)
self.out(fmt % (route.name, pattern, view_callable))
+ return 0
diff --git a/pyramid/scripts/pserve.py b/pyramid/scripts/pserve.py
index a0a3a8a70..a73cbde3a 100644
--- a/pyramid/scripts/pserve.py
+++ b/pyramid/scripts/pserve.py
@@ -16,6 +16,7 @@ import os
import re
import subprocess
import sys
+import textwrap
import threading
import time
import traceback
@@ -28,17 +29,14 @@ MAXFD = 1024
def main(argv=sys.argv, quiet=False):
command = PServeCommand(argv, quiet=quiet)
- command.run()
+ return command.run()
class DaemonizeException(Exception):
pass
class PServeCommand(object):
- usage = 'CONFIG_FILE [start|stop|restart|status] [var=value]'
- takes_config_file = 1
- summary = ("Serve the application described in CONFIG_FILE or control "
- "daemon status"),
+ usage = '%prog config_uri [start|stop|restart|status] [var=value]'
description = """\
This command serves a web application that uses a PasteDeploy
configuration file for the server and application.
@@ -51,7 +49,10 @@ class PServeCommand(object):
"""
verbose = 1
- parser = optparse.OptionParser()
+ parser = optparse.OptionParser(
+ usage,
+ description=textwrap.dedent(description)
+ )
parser.add_option(
'-n', '--app-name',
dest='app_name',
@@ -158,7 +159,7 @@ class PServeCommand(object):
if not self.args:
self.out('You must give a config file')
- return
+ return 2
app_spec = self.args[0]
if (len(self.args) > 1
and self.args[1] in self.possible_subcommands):
@@ -181,7 +182,7 @@ class PServeCommand(object):
if cmd not in (None, 'start', 'stop', 'restart', 'status'):
self.out(
'Error: must give start|stop|restart (not %s)' % cmd)
- return
+ return 2
if cmd == 'status' or self.options.show_status:
return self.show_status()
@@ -244,7 +245,7 @@ class PServeCommand(object):
except DaemonizeException as ex:
if self.verbose > 0:
self.out(str(ex))
- return
+ return 2
if (self.options.monitor_restart
and not os.environ.get(self._monitor_environ_key)):
diff --git a/pyramid/scripts/pshell.py b/pyramid/scripts/pshell.py
index dfac9dbce..7a21eaf98 100644
--- a/pyramid/scripts/pshell.py
+++ b/pyramid/scripts/pshell.py
@@ -1,6 +1,7 @@
from code import interact
import optparse
import sys
+import textwrap
from pyramid.compat import configparser
from pyramid.util import DottedNameResolver
@@ -10,32 +11,29 @@ from pyramid.paster import setup_logging
def main(argv=sys.argv, quiet=False):
command = PShellCommand(argv, quiet)
- command.run()
+ return command.run()
class PShellCommand(object):
- """Open an interactive shell with a :app:`Pyramid` app loaded.
-
- This command accepts one positional argument:
-
- ``config_uri`` -- specifies the PasteDeploy config file to use for the
- interactive shell. The format is ``inifile#name``. If the name is left
- off, ``main`` will be assumed.
-
- Example::
-
- $ pshell myapp.ini#main
-
- .. note:: If you do not point the loader directly at the section of the
- ini file containing your :app:`Pyramid` application, the
- command will attempt to find the app for you. If you are
- loading a pipeline that contains more than one :app:`Pyramid`
- application within it, the loader will use the last one.
-
+ usage = '%prog config_uri'
+ description = """\
+ Open an interactive shell with a Pyramid app loaded. This command
+ accepts one positional argument named "config_uri" which specifies the
+ PasteDeploy config file to use for the interactive shell. The format is
+ "inifile#name". If the name is left off, the Pyramid default application
+ will be assumed. Example: "pshell myapp.ini#main"
+
+ If you do not point the loader directly at the section of the ini file
+ containing your Pyramid application, the command will attempt to
+ find the app for you. If you are loading a pipeline that contains more
+ than one Pyramid application within it, the loader will use the
+ last one.
"""
bootstrap = (bootstrap,) # for testing
- summary = "Open an interactive shell with a Pyramid application loaded"
- parser = optparse.OptionParser()
+ parser = optparse.OptionParser(
+ usage,
+ description=textwrap.dedent(description)
+ )
parser.add_option('-p', '--python-shell',
action='store', type='string', dest='python_shell',
default='', help='ipython | bpython | python')
@@ -82,7 +80,7 @@ class PShellCommand(object):
def run(self, shell=None):
if not self.args:
self.out('Requires a config file argument')
- return
+ return 2
config_uri = self.args[0]
config_file = config_uri.split('#', 1)[0]
setup_logging(config_file)
diff --git a/pyramid/scripts/ptweens.py b/pyramid/scripts/ptweens.py
index 5bc0c7fbe..d3e17db58 100644
--- a/pyramid/scripts/ptweens.py
+++ b/pyramid/scripts/ptweens.py
@@ -1,5 +1,6 @@
import optparse
import sys
+import textwrap
from pyramid.interfaces import ITweens
@@ -9,31 +10,29 @@ from pyramid.paster import bootstrap
def main(argv=sys.argv, quiet=False):
command = PTweensCommand(argv, quiet)
- command.run()
+ return command.run()
class PTweensCommand(object):
- """Print all implicit and explicit :term:`tween` objects used by a
- Pyramid application. The handler output includes whether the system is
- using an explicit tweens ordering (will be true when the
- ``pyramid.tweens`` setting is used) or an implicit tweens ordering (will
- be true when the ``pyramid.tweens`` setting is *not* used).
-
- This command accepts one positional argument:
-
- ``config_uri`` -- specifies the PasteDeploy config file to use for the
- interactive shell. The format is ``inifile#name``. If the name is left
- off, ``main`` will be assumed.
-
- Example::
-
- $ ptweens myapp.ini#main
+ usage = '%prog config_uri'
+ description = """\
+ Print all implicit and explicit tween objects used by a Pyramid
+ application. The handler output includes whether the system is using an
+ explicit tweens ordering (will be true when the "pyramid.tweens"
+ deployment setting is used) or an implicit tweens ordering (will be true
+ when the "pyramid.tweens" deployment setting is *not* used).
+
+ This command accepts one positional argument named "config_uri" which
+ specifies the PasteDeploy config file to use for the interactive
+ shell. The format is "inifile#name". If the name is left off, "main"
+ will be assumed. Example: "ptweens myapp.ini#main".
"""
- summary = "Print all tweens related to a Pyramid application"
- stdout = sys.stdout
-
- parser = optparse.OptionParser()
+ parser = optparse.OptionParser(
+ usage,
+ description=textwrap.dedent(description),
+ )
+ stdout = sys.stdout
bootstrap = (bootstrap,) # testing
def __init__(self, argv, quiet=False):
@@ -61,7 +60,7 @@ class PTweensCommand(object):
def run(self):
if not self.args:
self.out('Requires a config file argument')
- return
+ return 2
config_uri = self.args[0]
env = self.bootstrap[0](config_uri)
registry = env['registry']
@@ -86,3 +85,4 @@ class PTweensCommand(object):
self.out('Implicit Tween Chain')
self.out('')
self.show_chain(tweens.implicit())
+ return 0
diff --git a/pyramid/scripts/pviews.py b/pyramid/scripts/pviews.py
index 38d510542..72a9800c3 100644
--- a/pyramid/scripts/pviews.py
+++ b/pyramid/scripts/pviews.py
@@ -1,36 +1,34 @@
import optparse
import sys
+import textwrap
from pyramid.interfaces import IMultiView
from pyramid.paster import bootstrap
def main(argv=sys.argv, quiet=False):
command = PViewsCommand(argv, quiet)
- command.run()
+ return command.run()
class PViewsCommand(object):
- """Print, for a given URL, the views that might match. Underneath each
+ usage = '%prog config_uri url'
+ description = """\
+ Print, for a given URL, the views that might match. Underneath each
potentially matching route, list the predicates required. Underneath
each route+predicate set, print each view that might match and its
predicates.
- This command accepts two positional arguments:
-
- ``config_uri`` -- specifies the PasteDeploy config file to use for the
- interactive shell. The format is ``inifile#name``. If the name is left
- off, ``main`` will be assumed.
-
- ``url`` -- specifies the URL that will be used to find matching views.
-
- Example::
-
- $ proutes myapp.ini#main url
-
+ This command accepts two positional arguments: "config_uri" specifies the
+ PasteDeploy config file to use for the interactive shell. The format is
+ "inifile#name". If the name is left off, "main" will be assumed. "url"
+ specifies the path info portion of a URL that will be used to find
+ matching views. Example: "proutes myapp.ini#main /url"
"""
- summary = "Print all views in an application that might match a URL"
stdout = sys.stdout
- parser = optparse.OptionParser()
+ parser = optparse.OptionParser(
+ usage,
+ description=textwrap.dedent(description)
+ )
bootstrap = (bootstrap,) # testing
@@ -231,7 +229,7 @@ class PViewsCommand(object):
def run(self):
if len(self.args) < 2:
self.out('Command requires a config file arg and a url arg')
- return
+ return 2
config_uri, url = self.args
if not url.startswith('/'):
url = '/%s' % url
@@ -256,3 +254,5 @@ class PViewsCommand(object):
else:
self.out(" Not found.")
self.out('')
+ return 0
+
diff --git a/pyramid/tests/test_scripts/test_pcreate.py b/pyramid/tests/test_scripts/test_pcreate.py
index 363808a1e..1406d3911 100644
--- a/pyramid/tests/test_scripts/test_pcreate.py
+++ b/pyramid/tests/test_scripts/test_pcreate.py
@@ -22,7 +22,7 @@ class TestPCreateCommand(unittest.TestCase):
def test_run_show_scaffolds_exist(self):
cmd = self._makeOne('-l')
result = cmd.run()
- self.assertEqual(result, True)
+ self.assertEqual(result, 0)
out = self.out_.getvalue()
self.assertTrue(out.startswith('Available scaffolds'))
@@ -30,14 +30,14 @@ class TestPCreateCommand(unittest.TestCase):
cmd = self._makeOne('-l')
cmd.scaffolds = []
result = cmd.run()
- self.assertEqual(result, True)
+ self.assertEqual(result, 0)
out = self.out_.getvalue()
self.assertTrue(out.startswith('No scaffolds available'))
def test_run_no_scaffold_name(self):
cmd = self._makeOne()
result = cmd.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 2)
out = self.out_.getvalue()
self.assertTrue(out.startswith(
'You must provide at least one scaffold name'))
@@ -45,14 +45,14 @@ class TestPCreateCommand(unittest.TestCase):
def test_no_project_name(self):
cmd = self._makeOne('-s', 'dummy')
result = cmd.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 2)
out = self.out_.getvalue()
self.assertTrue(out.startswith('You must provide a project name'))
def test_unknown_scaffold_name(self):
cmd = self._makeOne('-s', 'dummyXX', 'distro')
result = cmd.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 2)
out = self.out_.getvalue()
self.assertTrue(out.startswith('Unavailable scaffolds'))
@@ -62,7 +62,7 @@ class TestPCreateCommand(unittest.TestCase):
scaffold = DummyScaffold('dummy')
cmd.scaffolds = [scaffold]
result = cmd.run()
- self.assertEqual(result, True)
+ self.assertEqual(result, 0)
self.assertEqual(
scaffold.output_dir,
os.path.normpath(os.path.join(os.getcwd(), 'Distro'))
@@ -78,7 +78,7 @@ class TestPCreateCommand(unittest.TestCase):
scaffold = DummyScaffold('dummy')
cmd.scaffolds = [scaffold]
result = cmd.run()
- self.assertEqual(result, True)
+ self.assertEqual(result, 0)
self.assertEqual(
scaffold.output_dir,
os.path.normpath(os.path.join(os.getcwd(), 'Distro'))
@@ -94,7 +94,7 @@ class TestPCreateCommand(unittest.TestCase):
scaffold2 = DummyScaffold('dummy2')
cmd.scaffolds = [scaffold1, scaffold2]
result = cmd.run()
- self.assertEqual(result, True)
+ self.assertEqual(result, 0)
self.assertEqual(
scaffold1.output_dir,
os.path.normpath(os.path.join(os.getcwd(), 'Distro'))
@@ -117,7 +117,7 @@ class Test_main(unittest.TestCase):
def test_it(self):
result = self._callFUT(['pcreate'])
- self.assertEqual(result, None)
+ self.assertEqual(result, 2)
class DummyScaffold(object):
def __init__(self, name):
diff --git a/pyramid/tests/test_scripts/test_proutes.py b/pyramid/tests/test_scripts/test_proutes.py
index 328d1001d..8c2660465 100644
--- a/pyramid/tests/test_scripts/test_proutes.py
+++ b/pyramid/tests/test_scripts/test_proutes.py
@@ -19,7 +19,7 @@ class TestPRoutesCommand(unittest.TestCase):
L = []
command.out = L.append
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(L, [])
def test_no_mapper(self):
@@ -28,7 +28,7 @@ class TestPRoutesCommand(unittest.TestCase):
L = []
command.out = L.append
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(L, [])
def test_single_route_no_route_registered(self):
@@ -39,7 +39,7 @@ class TestPRoutesCommand(unittest.TestCase):
L = []
command.out = L.append
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(len(L), 3)
self.assertEqual(L[-1].split(), ['a', '/a', '<unknown>'])
@@ -51,7 +51,7 @@ class TestPRoutesCommand(unittest.TestCase):
L = []
command.out = L.append
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(len(L), 3)
self.assertEqual(L[-1].split(), ['a', '/a', '<unknown>'])
@@ -72,7 +72,7 @@ class TestPRoutesCommand(unittest.TestCase):
command.out = L.append
command.bootstrap = (dummy.DummyBootstrap(registry=registry),)
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(len(L), 3)
self.assertEqual(L[-1].split()[:3], ['a', '/a', 'None'])
@@ -98,7 +98,7 @@ class TestPRoutesCommand(unittest.TestCase):
command.out = L.append
command.bootstrap = (dummy.DummyBootstrap(registry=registry),)
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(len(L), 3)
self.assertEqual(L[-1].split()[:4], ['a', '/a', '<function', 'view'])
@@ -127,7 +127,7 @@ class TestPRoutesCommand(unittest.TestCase):
command.out = L.append
command.bootstrap = (dummy.DummyBootstrap(registry=registry),)
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(len(L), 3)
self.assertEqual(L[-1].split()[:3], ['a', '/a', '<unknown>'])
@@ -146,5 +146,5 @@ class Test_main(unittest.TestCase):
def test_it(self):
result = self._callFUT(['proutes'])
- self.assertEqual(result, None)
+ self.assertEqual(result, 2)
diff --git a/pyramid/tests/test_scripts/test_pserve.py b/pyramid/tests/test_scripts/test_pserve.py
index b181a7af2..fe489aa66 100644
--- a/pyramid/tests/test_scripts/test_pserve.py
+++ b/pyramid/tests/test_scripts/test_pserve.py
@@ -23,7 +23,7 @@ class TestPServeCommand(unittest.TestCase):
def test_run_no_args(self):
inst = self._makeOne()
result = inst.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 2)
self.assertEqual(self.out_.getvalue(), 'You must give a config file')
def test_run_stop_daemon_no_such_pid_file(self):
@@ -73,7 +73,7 @@ class Test_main(unittest.TestCase):
def test_it(self):
result = self._callFUT(['pserve'])
- self.assertEqual(result, None)
+ self.assertEqual(result, 2)
class TestLazyWriter(unittest.TestCase):
def _makeOne(self, filename, mode='w'):
diff --git a/pyramid/tests/test_scripts/test_pshell.py b/pyramid/tests/test_scripts/test_pshell.py
index 765042152..8f9f3abfb 100644
--- a/pyramid/tests/test_scripts/test_pshell.py
+++ b/pyramid/tests/test_scripts/test_pshell.py
@@ -337,5 +337,5 @@ class Test_main(unittest.TestCase):
def test_it(self):
result = self._callFUT(['pshell'])
- self.assertEqual(result, None)
+ self.assertEqual(result, 2)
diff --git a/pyramid/tests/test_scripts/test_ptweens.py b/pyramid/tests/test_scripts/test_ptweens.py
index 4dddaa0aa..f39f84b68 100644
--- a/pyramid/tests/test_scripts/test_ptweens.py
+++ b/pyramid/tests/test_scripts/test_ptweens.py
@@ -18,7 +18,7 @@ class TestPTweensCommand(unittest.TestCase):
L = []
command.out = L.append
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(L, [])
def test_command_implicit_tweens_only(self):
@@ -28,7 +28,7 @@ class TestPTweensCommand(unittest.TestCase):
L = []
command.out = L.append
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(
L[0],
'"pyramid.tweens" config value NOT set (implicitly ordered tweens '
@@ -41,7 +41,7 @@ class TestPTweensCommand(unittest.TestCase):
L = []
command.out = L.append
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(
L[0],
'"pyramid.tweens" config value set (explicitly ordered tweens used)')
@@ -58,4 +58,4 @@ class Test_main(unittest.TestCase):
def test_it(self):
result = self._callFUT(['ptweens'])
- self.assertEqual(result, None)
+ self.assertEqual(result, 2)
diff --git a/pyramid/tests/test_scripts/test_pviews.py b/pyramid/tests/test_scripts/test_pviews.py
index e2c3892fa..680d48cee 100644
--- a/pyramid/tests/test_scripts/test_pviews.py
+++ b/pyramid/tests/test_scripts/test_pviews.py
@@ -231,7 +231,7 @@ class TestPViewsCommand(unittest.TestCase):
command._find_view = lambda arg1, arg2: None
command.args = ('/foo/bar/myapp.ini#myapp', '/a')
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(L[1], 'URL = /a')
self.assertEqual(L[3], ' Not found.')
@@ -244,7 +244,7 @@ class TestPViewsCommand(unittest.TestCase):
command._find_view = lambda arg1, arg2: None
command.args = ('/foo/bar/myapp.ini#myapp', 'a')
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(L[1], 'URL = /a')
self.assertEqual(L[3], ' Not found.')
@@ -258,7 +258,7 @@ class TestPViewsCommand(unittest.TestCase):
command._find_view = lambda arg1, arg2: view
command.args = ('/foo/bar/myapp.ini#myapp', '/a')
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(L[1], 'URL = /a')
self.assertEqual(L[3], ' context: context')
self.assertEqual(L[4], ' view name: a')
@@ -276,7 +276,7 @@ class TestPViewsCommand(unittest.TestCase):
command._find_view = lambda arg1, arg2: view
command.args = ('/foo/bar/myapp.ini#myapp', '/a')
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(L[1], 'URL = /a')
self.assertEqual(L[3], ' context: context')
self.assertEqual(L[4], ' view name: a')
@@ -294,7 +294,7 @@ class TestPViewsCommand(unittest.TestCase):
command._find_view = lambda arg1, arg2: view
command.args = ('/foo/bar/myapp.ini#myapp', '/a')
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(L[1], 'URL = /a')
self.assertEqual(L[3], ' context: context')
self.assertEqual(L[4], ' view name: a')
@@ -315,7 +315,7 @@ class TestPViewsCommand(unittest.TestCase):
command._find_view = lambda arg1, arg2: view
command.args = ('/foo/bar/myapp.ini#myapp', '/a')
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(L[1], 'URL = /a')
self.assertEqual(L[3], ' context: context')
self.assertEqual(L[4], ' view name: a')
@@ -335,7 +335,7 @@ class TestPViewsCommand(unittest.TestCase):
command._find_view = lambda arg1, arg2: view
command.args = ('/foo/bar/myapp.ini#myapp', '/a')
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(L[1], 'URL = /a')
self.assertEqual(L[3], ' context: context')
self.assertEqual(L[4], ' view name: a')
@@ -363,7 +363,7 @@ class TestPViewsCommand(unittest.TestCase):
command._find_view = lambda arg1, arg2: multiview2
command.args = ('/foo/bar/myapp.ini#myapp', '/a')
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(L[1], 'URL = /a')
self.assertEqual(L[3], ' context: context')
self.assertEqual(L[4], ' view name: a')
@@ -386,7 +386,7 @@ class TestPViewsCommand(unittest.TestCase):
command._find_view = lambda arg1, arg2: view
command.args = ('/foo/bar/myapp.ini#myapp', '/a')
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(L[1], 'URL = /a')
self.assertEqual(L[3], ' context: context')
self.assertEqual(L[4], ' view name: a')
@@ -412,7 +412,7 @@ class TestPViewsCommand(unittest.TestCase):
command._find_view = lambda arg1, arg2: multiview
command.args = ('/foo/bar/myapp.ini#myapp', '/a')
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(L[1], 'URL = /a')
self.assertEqual(L[3], ' context: context')
self.assertEqual(L[4], ' view name: a')
@@ -433,7 +433,7 @@ class TestPViewsCommand(unittest.TestCase):
command._find_view = lambda arg1, arg2: multiview
command.args = ('/foo/bar/myapp.ini#myapp', '/a')
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(L[1], 'URL = /a')
self.assertEqual(L[3], ' context: context')
self.assertEqual(L[4], ' view name: a')
@@ -457,7 +457,7 @@ class TestPViewsCommand(unittest.TestCase):
command._find_view = lambda arg1, arg2: multiview
command.args = ('/foo/bar/myapp.ini#myapp', '/a')
result = command.run()
- self.assertEqual(result, None)
+ self.assertEqual(result, 0)
self.assertEqual(L[1], 'URL = /a')
self.assertEqual(L[3], ' context: context')
self.assertEqual(L[4], ' view name: a')
@@ -472,4 +472,4 @@ class Test_main(unittest.TestCase):
def test_it(self):
result = self._callFUT(['pviews'])
- self.assertEqual(result, None)
+ self.assertEqual(result, 2)