From fcb62c0166fff690601873ea2997e5bcf37dee40 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Thu, 17 Sep 2026 14:14:48 -0500 Subject: [PATCH] Isolate output_style tests from environment These tests appear to assume that the COLCON_DEFAULT_OUTPUT_STYLE environment variable is not set when they're invoked. Since testing colcon itself using colcon is a supported scenario, we'll need to isolate the tests from that variable. --- test/test_output_style.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/test_output_style.py b/test/test_output_style.py index 08075f4d..97a4c85d 100644 --- a/test/test_output_style.py +++ b/test/test_output_style.py @@ -3,6 +3,7 @@ import argparse from io import StringIO +import os import runpy from types import SimpleNamespace from unittest.mock import patch @@ -38,6 +39,13 @@ def apply_style(self, style): style.Warning = MarkdownItalic +@pytest.fixture(autouse=True, scope='module') +def _clean_env(): + with patch.dict(os.environ): + os.environ.pop(DEFAULT_OUTPUT_STYLE_ENVIRONMENT_VARIABLE.name, None) + yield + + def test_add_output_style_arguments(): # No extensions available parser = argparse.ArgumentParser()