diff --git a/agvis/static/js/TimeBox.js b/agvis/static/js/TimeBox.js index d79b7de..4cce7c1 100644 --- a/agvis/static/js/TimeBox.js +++ b/agvis/static/js/TimeBox.js @@ -38,11 +38,17 @@ L.SimTimeBox = L.Control.extend({ * @returns */ onAdd: function(map) { - this.simulation_time = 0; - this.text = L.DomUtil.create('div'); - this.text.id = "info_text"; - this.text.innerHTML = "

Simulation time: " + this.simulation_time + "

"; - return this.text; + if (typeof L !== 'undefined') { + this.simulation_time = 0; + this.text = L.DomUtil.create('div'); + this.text.id = "info_text"; + this.text.innerHTML = "

Simulation time: " + this.simulation_time + "

"; + return this.text; + } + else { + console.error("Leaflet not found."); + return null; + } }, /** diff --git a/agvis/web.py b/agvis/web.py index 7cabfb2..d02c9e4 100644 --- a/agvis/web.py +++ b/agvis/web.py @@ -10,7 +10,9 @@ import sys import subprocess from flask import Flask, render_template, send_from_directory -from .flask_configurations import * +from .flask_configurations import DefaultConfig +from .flask_configurations import DevelopmentConfig +from .flask_configurations import ProductionConfig import requests class AgvisWeb(): @@ -71,7 +73,7 @@ def run(self, host='localhost', port=8810, workers=1, dev=False): dev = True # Run flask as a development server - if (dev == True): + if (dev): self.app.config.from_object(DevelopmentConfig()) command = [ @@ -95,7 +97,7 @@ def run(self, host='localhost', port=8810, workers=1, dev=False): ] # Start the application - with self.app.requests_session as session: + with self.app.requests_session: subprocess.run(command, check=True, cwd=self.app_dir) except KeyboardInterrupt: diff --git a/go.sh b/go.sh index 03a7f9e..6cb8b06 100755 --- a/go.sh +++ b/go.sh @@ -21,7 +21,7 @@ piptrustedhost= build() { # Set Agvis Branch - local BRANCH_NAME=master + local BRANCH_NAME="master" if [ "$1" ]; then BRANCH_NAME=$1 fi @@ -47,7 +47,7 @@ build() { ${target:+--target $target} \ ${pipindex:+--build-arg PIP_INDEX_URL=$pipindex} \ ${piptrustedhost:+--build-arg PIP_TRUSTED_HOST=$piptrustedhost} \ - --build-arg BRANCH_NAME=$BRANCH_NAME \ + --build-arg BRANCH_NAME="$BRANCH_NAME" \ -t $tag . } @@ -57,7 +57,6 @@ run_tests() { dev2() { google-chrome --incognito http://localhost:8810/ 2> /dev/null > /dev/null & - tmux split-window -v tmux split-window -v tmux select-layout tiled diff --git a/tests/test_cli.py b/tests/test_cli.py index 7ee91b6..0c1771f 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -55,6 +55,10 @@ def mock_subprocess_run(c2, **kwargs): with capsys.disabled(), pytest.raises(SystemExit): main() +# ================================================================================ +# DISABLED: This test runs different locally than on GitHub Actions +# ================================================================================ + # def test_agvis_run_invalid_command(monkeypatch, capsys): # c1 = "agvis invalid_command" diff --git a/tests/test_web.py b/tests/test_web.py index ed76264..c94d68a 100644 --- a/tests/test_web.py +++ b/tests/test_web.py @@ -6,8 +6,6 @@ # ================================================================================ import os, os.path -import pytest -from tests.conftest import client def test_index(client): response = client.get('/')