From df4f85fc2c0a2b47c33191d4800b9259490a0a2c Mon Sep 17 00:00:00 2001 From: Flavio Calva Date: Wed, 20 Jul 2022 18:42:40 +0100 Subject: [PATCH] fixes for building --- pmachines/app.py | 4 +++- prj.org | 3 ++- tests/test_functional.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pmachines/app.py b/pmachines/app.py index 0b0234c..153ba71 100755 --- a/pmachines/app.py +++ b/pmachines/app.py @@ -8,6 +8,7 @@ from sys import platform, argv, exit from logging import info, debug from os.path import exists from os import makedirs +from multiprocessing import cpu_count from panda3d.core import Filename, load_prc_file_data, AntialiasAttrib, \ Texture, WindowProperties, LVector2i, TextNode from panda3d.bullet import BulletWorld, BulletDebugNode @@ -304,5 +305,6 @@ class PmachinesApp: self.__fps_lst.pop(0) self.__fps_lst += [globalClock.average_frame_rate] if len(self.__fps_lst) == 4: - assert(any(fps > 55 for fps in self.__fps_lst)) + fps_threshold = 55 if cpu_count() >= 4 else 25 + assert(any(fps > fps_threshold for fps in self.__fps_lst), 'low fps %s' % self.__fps_lst) return task.again diff --git a/prj.org b/prj.org index 46e3f6c..b0fab58 100644 --- a/prj.org +++ b/prj.org @@ -3,7 +3,8 @@ #+CATEGORY: pmachines #+TAGS: bug(b) calendar(c) waiting(w) -* CODE create builds, update website and itch.io +* CODE asserts (also fps) only for dev or functional tests +* READY create builds and update website/itch.io * READY refactoring (recurring task) * BACKLOG intro animation (from target item to start position) * BACKLOG buttons of the scenes enabled sequentially diff --git a/tests/test_functional.py b/tests/test_functional.py index 994f557..49ab3ff 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -61,7 +61,7 @@ class FunctionalTests(TestCase): def __similar_images(self, ref_img, tst_img): cmd = 'magick compare -metric NCC %s %s diff.png' % (ref_img, tst_img) - res = exec_cmd(cmd) + res = exec_cmd(cmd, False) if exists('diff.png'): remove('diff.png') print('compare %s %s: %s' % (ref_img, tst_img, res)) return float(res) > .8 -- 2.30.2