def test_capture_usage(self): sys.argv[0] = 'manage.py' with capture() as c: manager.main(args=[]) self.assertMultiLineEqual( c.getvalue(), """\ usage: manage.py [<namespace>.]<command> [<args>] positional arguments: command the command to run optional arguments: -h, --help show this help message and exit available commands: class_based no description raises no description simple_command no description [my_namespace] namespaced namespaced command """ )
def main(): try: sys.path.append(os.getcwd()) imp.load_source('manage_file', os.path.join(os.getcwd(), 'manage.py')) except IOError as exc: return puts(cli.red(exc)) from manage_file import manager manager.main()
def test_capture_usage(self): sys.argv[0] = 'manage.py' with capture() as c: manager.main(args=[]) self.assertMultiLineEqual( c.getvalue(), """\ usage: manage.py [<namespace>.]<command> [<args>] positional arguments: command the command to run optional arguments: -h, --help show this help message and exit available commands: class_based no description raises no description simple_command no description [my_namespace] namespaced namespaced command """)