commaai / panda

code powering the comma.ai panda
MIT License
1.5k stars 744 forks source link

CI: fix misra mutation tests #1934

Closed jnewb1 closed 3 months ago

jnewb1 commented 3 months ago

this has been failing but pytest.main doesn't exit, you need to exit manually...

 _____________________ test_misra_mutation[None-None-False] _____________________
[gw0] linux -- Python 3.11.4 /root/.pyenv/versions/3.11.4/bin/python3

fn = None, patch = None, should_fail = False

    @pytest.mark.parametrize("fn, patch, should_fail", mutations)
    def test_misra_mutation(fn, patch, should_fail):
      with tempfile.TemporaryDirectory() as tmp:
        shutil.copytree(ROOT, tmp, dirs_exist_ok=True)

        # apply patch
        if fn is not None:
          r = os.system(f"cd {tmp} && sed -i '{patch}' {fn}")
          assert r == 0

        # run test
        r = subprocess.run("tests/misra/test_misra.sh", cwd=tmp, shell=True)
        failed = r.returncode != 0
>       assert failed == should_fail
E       assert True == False

test_mutation.py:81: AssertionError