Example #1
0
 def test_version(self, versionarg, capsys):
     with raises(SystemExit) as exc_info:
         main(['progname', versionarg])
     out, err = capsys.readouterr()
     # Should print out version.
     assert err == '{0} {1}\n'.format(metadata.project, metadata.version)
     # Should exit with zero return code.
     assert exc_info.value.code == 0
Example #2
0
 def test_help(self, helparg, capsys):
     with raises(SystemExit) as exc_info:
         main(['progname', helparg])
     out, err = capsys.readouterr()
     # Should have printed some sort of usage message. We don't
     # need to explicitly test the content of the message.
     assert 'usage' in out
     # Should have used the program name from the argument
     # vector.
     assert 'progname' in out
     # Should exit with zero return code.
     assert exc_info.value.code == 0
Example #3
0
def run(args):
    """Run the package's main script. All arguments are passed to it."""
    # The main script expects to get the called executable's name as
    # argv[0]. However, paver doesn't provide that in args. Even if it did (or
    # we dove into sys.argv), it wouldn't be useful because it would be paver's
    # executable. So we just pass the package name in as the executable name,
    # since it's close enough. This should never be seen by an end user
    # installing through Setuptools anyway.
    from lupin.main import main
    raise SystemExit(main([CODE_DIRECTORY] + args))