Skip to content

Commit 4db0f65

Browse files
committed
add explicit forced fail
1 parent f23c2dc commit 4db0f65

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import shutil
33
import tarfile
4+
import pytest
45
from pathlib import Path
56
from typing import Final, Optional, Set
67

@@ -224,3 +225,11 @@ def pytest_sessionfinish(
224225

225226
assert lock_file is not None
226227
lock_file.release()
228+
229+
230+
# This is required explicitly becuase when the source does not have any
231+
# mutable code, mutmut does not run the forced fail condition.
232+
@pytest.fixture(autouse=True)
233+
def mutmut_forced_fail():
234+
if os.environ.get("MUTANT_UNDER_TEST") == "fail":
235+
pytest.fail("Forced fail for mutmut sanity check")

0 commit comments

Comments
 (0)