Update unit test and preserve prior operational ordering in main.py

This commit is contained in:
sabaimran 2023-07-01 20:02:35 -07:00
parent ea9ae4ae28
commit 36537606da
2 changed files with 12 additions and 12 deletions

View file

@ -64,7 +64,16 @@ def run():
logger.info("🌘 Starting Khoj")
if args.gui:
if not args.gui:
if not state.demo:
# Setup task scheduler
poll_task_scheduler()
# Start Server
configure_server(args, required=False)
configure_routes(app)
start_server(app, host=args.host, port=args.port, socket=args.socket)
else:
logger.warning("🚧 GUI is being deprecated and may not work as expected. Starting...")
# Setup GUI
gui = QtWidgets.QApplication([])
@ -113,15 +122,6 @@ def run():
gui.exec()
if not state.demo:
# Setup task scheduler
poll_task_scheduler()
# Start Server
configure_server(args, required=False)
configure_routes(app)
start_server(app, host=args.host, port=args.port, socket=args.socket)
def sigint_handler(*args):
QtWidgets.QApplication.quit()

View file

@ -36,11 +36,11 @@ def test_cli_invalid_config_file_path():
# ----------------------------------------------------------------------------------------------------
def test_cli_config_from_file():
# Act
actual_args = cli(["-c=tests/data/config.yml", "--regenerate", "-vvv"])
actual_args = cli(["-c=tests/data/config.yml", "--regenerate", "--gui", "-vvv"])
# Assert
assert actual_args.config_file == resolve_absolute_path(Path("tests/data/config.yml"))
assert actual_args.gui == False
assert actual_args.gui == True
assert actual_args.regenerate == True
assert actual_args.config is not None
assert actual_args.verbose == 3