def test_error(exception, capsys): with patch('nameko.cli.run.main') as run: run.side_effect = exception('boom') main() out, _ = capsys.readouterr() assert out.strip() == 'Error: boom'
def test_run(): with patch('nameko.cli.run.main') as run: main() assert run.call_count == 1 (args, ), _ = run.call_args assert args.broker == 'my_broker'
import sys from nameko.cli.main import main main()
def test_run(): with patch('nameko.cli.run.main') as run: main() assert run.call_count == 1 (args,), _ = run.call_args assert args.broker == 'my_broker'
# Exact code from nameko pip shortcut import re import sys from nameko.cli.main import main if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(main())