Commit d6a08445 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

Merge tests into main script

parent d7266c70
......@@ -69,17 +69,24 @@ def run_cli(debug, extras=None):
agkcli.onecmd(' '.join(extras or ['help', ]))
def run_test(debug, extras=None):
LOGGER.removeHandler(HANDLER)
from agkyra.scripts import test
test.main(debug)
DISPATCH = {
'server': run_server,
'gui': run_gui,
'cli': run_cli,
'test': run_test,
}
parser = argparse.ArgumentParser(description='Agkyra syncer launcher')
parser.add_argument('--debug', '-d', action='store_true',
help="set logging level to 'debug'")
parser.add_argument('component', nargs="?", default="gui",
help="run 'server', 'cli', or 'gui' (default)")
help="run 'test', 'server', 'cli', or 'gui' (default)")
parser.add_argument('command', nargs="*", help="command in case of cli")
def main():
......
......@@ -31,6 +31,7 @@ import unittest
import mock
import sqlite3
import tempfile
import argparse
from functools import wraps
from agkyra.config import AgkyraConfig, CONFIG_PATH
......@@ -813,5 +814,23 @@ class AgkyraTest(unittest.TestCase):
handle.check_staged(live_info)
def set_debug(debug):
level = logging.DEBUG if debug else logging.INFO
logger.setLevel(level)
def main(debug):
set_debug(debug)
runner = unittest.TextTestRunner()
runner.run(unittest.makeSuite(AgkyraTest))
parser = argparse.ArgumentParser(description='Agkyra syncer launcher')
parser.add_argument('--debug', '-d', action='store_true',
help="set logging level to 'debug'")
if __name__ == '__main__':
unittest.main()
args = parser.parse_args()
debug = args.debug
main(debug)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment