Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure metadata is valid for result before assigning #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand Down Expand Up @@ -54,13 +54,13 @@ jobs:
htmlcov/*
junit/*
- name: install rel deps
if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
run: |
pip install wheel twine
python setup.py sdist
python setup.py bdist_wheel
- name: upload to pypi
if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
env:
TWINE_USERNAME: "${{secrets.TWINE_USERNAME}}"
TWINE_PASSWORD: "${{secrets.TWINE_PASSWORD}}"
Expand Down
Empty file added example/__init__.py
Empty file.
File renamed without changes.
11 changes: 11 additions & 0 deletions pytest_opentmi/OpenTmiReport.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
OpenTmiReport module
"""
import json
import os
import time
import datetime
Expand Down Expand Up @@ -215,6 +216,16 @@ def _new_result(self, report):
for item in self.config.option.metadata:
key, value = item

if not isinstance(key, str):
logger.warning(f"Metadata key is not string: {key}")
continue
# ensure value is JSON serializable with JSON.dumps
try:
json.dumps(value)
except TypeError:
logger.warning(f"Metadata value is not JSON serializable: {value}")
continue

# Dut
if key.startswith('DUT') and not dut:
dut = Dut()
Expand Down
Loading