Skip to content

Commit

Permalink
green tests
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Henkel <christian.henkel2@de.bosch.com>
  • Loading branch information
ct2034 committed Nov 13, 2023
1 parent e92ff38 commit 3e65036
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 61 deletions.
9 changes: 7 additions & 2 deletions bt_view/src/bt_view/bt_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from hashlib import sha256
from math import log
import os
from typing import Dict, List, Optional, Union
Expand Down Expand Up @@ -56,6 +57,10 @@
COLORS_PER_RETURN_STATE_VALUE[None] = COLORS_PER_RETURN_STATE[None]


def my_hash(s: object) -> str:
return sha256(str(s).encode()).hexdigest()[:20]


def _colormap(cm_name: str, value: Optional[float]) -> str:
if value is None:
# grey for missing values
Expand Down Expand Up @@ -135,7 +140,7 @@ def _make_return_value_bargraph(
return None
if not os.path.exists(BG_IMG_FOLDER):
os.makedirs(BG_IMG_FOLDER)
img_hash = hash(tuple(retvalues_counts))
img_hash = my_hash(tuple(retvalues_counts))
img_path = os.path.join(
BG_IMG_FOLDER,
f'{img_hash}.png')
Expand Down Expand Up @@ -164,7 +169,7 @@ def _make_history_image(
return None
if not os.path.exists(BG_IMG_FOLDER):
os.makedirs(BG_IMG_FOLDER)
img_hash = hash(tuple(states))
img_hash = my_hash(tuple(states))
img_path = os.path.join(
BG_IMG_FOLDER,
f'h{img_hash}.png')
Expand Down
24 changes: 12 additions & 12 deletions bt_view/test/_test_data/reference/bt_trace1_demo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions bt_view/test/_test_data/reference/bt_trace1_fbl_log_states.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3e65036

Please sign in to comment.