From 01e8525082f65917823aa21233f5dec4fef0a0b7 Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Wed, 15 Apr 2026 11:11:09 +0000 Subject: [PATCH] tests: Initialize sigmonitor where needed Don't rely on other test files to do the initialization - this doesn't work when a particular test is executed. The sigmonitor is used, e.g., for using the utility for child process launching. --- cvise/tests/test_clangincludegraph.py | 6 ++++++ cvise/tests/test_clexhints.py | 7 +++++++ cvise/tests/test_ifs.py | 7 +++++++ cvise/tests/test_treesitter.py | 7 +++++++ 4 files changed, 27 insertions(+) diff --git a/cvise/tests/test_clangincludegraph.py b/cvise/tests/test_clangincludegraph.py index bbb9cc9a0..6e70ce460 100644 --- a/cvise/tests/test_clangincludegraph.py +++ b/cvise/tests/test_clangincludegraph.py @@ -9,6 +9,12 @@ from cvise.utils.externalprograms import find_external_programs from cvise.utils.hint import Hint, HintBundle, load_hints from cvise.utils.process import ProcessEventNotifier +from cvise.utils import sigmonitor + + +@pytest.fixture(autouse=True) +def signal_monitor(): + sigmonitor.init() def init_pass(tmp_dir: Path, input_path: Path) -> tuple[ClangIncludeGraphPass, Any]: diff --git a/cvise/tests/test_clexhints.py b/cvise/tests/test_clexhints.py index 0680cd9be..1ae6e0e0a 100644 --- a/cvise/tests/test_clexhints.py +++ b/cvise/tests/test_clexhints.py @@ -9,6 +9,13 @@ from cvise.tests.testabstract import collect_all_transforms, collect_all_transforms_dir, validate_stored_hints from cvise.utils.externalprograms import find_external_programs from cvise.utils.process import ProcessEventNotifier +from cvise.utils import sigmonitor + + +@pytest.fixture(autouse=True) +def signal_monitor(): + sigmonitor.init() + # How many times to repeat each test that involves randomness (for extra reassurance). RANDOM_TEST_REPETITIONS = 10 diff --git a/cvise/tests/test_ifs.py b/cvise/tests/test_ifs.py index e545bf047..4998b3f25 100644 --- a/cvise/tests/test_ifs.py +++ b/cvise/tests/test_ifs.py @@ -5,6 +5,13 @@ from cvise.passes.abstract import ProcessEventNotifier from cvise.passes.ifs import IfPass +from cvise.utils import sigmonitor +import pytest + + +@pytest.fixture(autouse=True) +def signal_monitor(): + sigmonitor.init() class LineMarkersTestCase(unittest.TestCase): diff --git a/cvise/tests/test_treesitter.py b/cvise/tests/test_treesitter.py index 278ee3708..e38b2f4ab 100644 --- a/cvise/tests/test_treesitter.py +++ b/cvise/tests/test_treesitter.py @@ -7,6 +7,13 @@ from cvise.tests.testabstract import collect_all_transforms, collect_all_transforms_dir, validate_stored_hints from cvise.utils.externalprograms import find_external_programs from cvise.utils.process import ProcessEventNotifier +from cvise.utils import sigmonitor + + +@pytest.fixture(autouse=True) +def signal_monitor(): + sigmonitor.init() + REPLACE_FUNC_DEF = 'replace-function-def-with-decl' ERASE_NAMESPACE = 'erase-namespace'