diff --git a/scorometer/main.py b/scorometer/main.py index d6ed176..5a12759 100755 --- a/scorometer/main.py +++ b/scorometer/main.py @@ -27,7 +27,8 @@ def send(o): print(json.dumps(o), flush=True) def log(level, message): - send({"type": "log", "level": level, "message": message}) + o = {"type": "log", "level": level, "message": message} + print(json.dumps(o), flush=True, file=sys.stderr) def debug(message): log("DEBUG", message) diff --git a/scorometer/tests/almost_perfect_play/output b/scorometer/tests/almost_perfect_play/output index bf3a024..9b9520c 100644 --- a/scorometer/tests/almost_perfect_play/output +++ b/scorometer/tests/almost_perfect_play/output @@ -7,4 +7,4 @@ {"id": 8, "timingScore": "perfect", "timingInformation": "perfect"} {"id": 9, "timingScore": "perfect", "timingInformation": "perfect"} {"id": 10, "timingScore": "perfect", "timingInformation": "perfect"} -{"overallScore": 900, "score": {}} +{"overallScore": 850, "score": {}} diff --git a/scorometer/tests/random_miss/output b/scorometer/tests/random_miss/output index c72e8a4..072470a 100644 --- a/scorometer/tests/random_miss/output +++ b/scorometer/tests/random_miss/output @@ -6,4 +6,4 @@ {"id": 8, "timingScore": "good", "timingInformation": "late"} {"id": 9, "timingScore": "perfect", "timingInformation": "perfect"} {"id": 10, "timingScore": "perfect", "timingInformation": "perfect"} -{"overallScore": 750, "score": {}} +{"overallScore": 650, "score": {}} diff --git a/scorometer/tests/runner.sh b/scorometer/tests/runner.sh index 471410f..f7d67c7 100755 --- a/scorometer/tests/runner.sh +++ b/scorometer/tests/runner.sh @@ -10,7 +10,7 @@ TESTS_SUCCESS=0 TESTS_FAILED=0 function test { - cat $1/input | BACK_URL="http://localhost:3000" MUSICS_FOLDER="../../musics/" python3 ../main.py | grep -v '"type": "log"' &> /tmp/scorometer_res + cat $1/input | BACK_URL="http://localhost:3000" MUSICS_FOLDER="../../musics/" python3 ../main.py 1> /tmp/scorometer_res 2> /dev/null TESTS_DONE=$((TESTS_DONE + 1)) if ! diff $1/output /tmp/scorometer_res &>/dev/null; then echo "$t failed, do runner.sh $t for more info" @@ -27,7 +27,7 @@ then done exit $TESTS_FAILED else - cat $1/input | BACK_URL="http://localhost:3000" MUSICS_FOLDER="../../musics/" python3 ../main.py | grep -v '"type": "log"' &> /tmp/scorometer_res + cat $1/input | BACK_URL="http://localhost:3000" MUSICS_FOLDER="../../musics/" python3 ../main.py 1> /tmp/scorometer_res 2> /dev/null echo "=========== CURRENT OUTPUT ===========" cat /tmp/scorometer_res echo "======================================"