示例#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 out == '{0} {1}\n'.format(metadata.project, metadata.version)

        # Should exit with zero return code.
        assert exc_info.value.code == 0
示例#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
示例#3
0
 def test_clock(self):
     # Arrange
     self.mock_clock.return_value = 'time'
     # Act
     result = main.main()
     # Assert
     self.assertEqual(result, 'time')
示例#4
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 server.main import main
    raise SystemExit(main([CODE_DIRECTORY] + args))
示例#5
0
import sys

from server.main import main

print('Running server as a module.')
main(sys.argv[1:])
示例#6
0
import sys
from server.main import main
from .db import run_script as sql
from .trade.player import run_script as play
from .tinkoff import main as api
import logging

logger = logging.getLogger(__name__)

if len(sys.argv) > 1:
    prog = sys.argv[1]
    if prog == 'api':
        api()
    elif prog == 'sql':
        sql()
    elif prog == 'play':
        play()
    else:
        print('NO Action! main start')
        main()
else:
    main()
示例#7
0
from server import main

main.main()