Pytest: consistent codecov (#30408)
* seed only * random seed * ignore version.py * increase max examples * increase default max examples old-commit-hash: d02dd50749c8dabc1cd3385bdf2cf3fb7cb7ac63
This commit is contained in:
2
.github/workflows/selfdrive_tests.yaml
vendored
2
.github/workflows/selfdrive_tests.yaml
vendored
@@ -27,7 +27,7 @@ env:
|
|||||||
RUN_CL: docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e PYTHONWARNINGS=error -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $CL_BASE_IMAGE /bin/sh -c
|
RUN_CL: docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e PYTHONWARNINGS=error -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $CL_BASE_IMAGE /bin/sh -c
|
||||||
|
|
||||||
UNIT_TEST: coverage run --append -m unittest discover
|
UNIT_TEST: coverage run --append -m unittest discover
|
||||||
PYTEST: pytest --continue-on-collection-errors --cov --cov-report=xml --cov-append --durations=0 --durations-min=5
|
PYTEST: pytest --continue-on-collection-errors --cov --cov-report=xml --cov-append --durations=0 --durations-min=5 --hypothesis-seed 0
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_release:
|
build_release:
|
||||||
|
|||||||
@@ -8,4 +8,5 @@ coverage:
|
|||||||
|
|
||||||
ignore:
|
ignore:
|
||||||
- "**/test_*.py"
|
- "**/test_*.py"
|
||||||
- "selfdrive/test/**"
|
- "selfdrive/test/**"
|
||||||
|
- "system/version.py" # codecov changes depending on if we are in a branch or not
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
|
import random
|
||||||
|
|
||||||
from openpilot.common.prefix import OpenpilotPrefix
|
from openpilot.common.prefix import OpenpilotPrefix
|
||||||
from openpilot.system.hardware import TICI
|
from openpilot.system.hardware import TICI
|
||||||
@@ -9,6 +10,8 @@ from openpilot.system.hardware import TICI
|
|||||||
def openpilot_function_fixture():
|
def openpilot_function_fixture():
|
||||||
starting_env = dict(os.environ)
|
starting_env = dict(os.environ)
|
||||||
|
|
||||||
|
random.seed(0)
|
||||||
|
|
||||||
# setup a clean environment for each test
|
# setup a clean environment for each test
|
||||||
with OpenpilotPrefix():
|
with OpenpilotPrefix():
|
||||||
prefix = os.environ["OPENPILOT_PREFIX"]
|
prefix = os.environ["OPENPILOT_PREFIX"]
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ from openpilot.selfdrive.test.fuzzy_generation import DrawType, FuzzyGenerator
|
|||||||
|
|
||||||
ALL_ECUS = list({ecu for ecus in FW_VERSIONS.values() for ecu in ecus.keys()})
|
ALL_ECUS = list({ecu for ecus in FW_VERSIONS.values() for ecu in ecus.keys()})
|
||||||
|
|
||||||
MAX_EXAMPLES = int(os.environ.get('MAX_EXAMPLES', '5'))
|
MAX_EXAMPLES = int(os.environ.get('MAX_EXAMPLES', '20'))
|
||||||
|
|
||||||
|
|
||||||
def get_fuzzy_car_interface_args(draw: DrawType) -> dict:
|
def get_fuzzy_car_interface_args(draw: DrawType) -> dict:
|
||||||
|
|||||||
Reference in New Issue
Block a user