diff --git a/ChangeLog.md b/ChangeLog.md index 3e9d851..4c871fc 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,7 @@ # Write Your Python Program - CHANGELOG +* 2.2.2 (2026-04-03) + * Fixed package hiding bug * 2.2.1 (2026-03-26) * Functionality for running standard unit tests * 2.2.0 (2026-03-17) diff --git a/package.json b/package.json index 26c60a0..eabb557 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Write Your Python Program!", "description": "A user friendly python environment for beginners", "license": "See license in LICENSE", - "version": "2.2.1", + "version": "2.2.2", "publisher": "StefanWehr", "icon": "icon.png", "engines": { diff --git a/python/code/wypp/ansi.py b/python/code/wypp/ansi.py index 8a49e9c..324002c 100644 --- a/python/code/wypp/ansi.py +++ b/python/code/wypp/ansi.py @@ -1,4 +1,6 @@ import re +import sys +import os RESET = "\u001b[0;0m" BOLD = "\u001b[1m" @@ -21,8 +23,22 @@ YELLOW = "\u001b[1;33m" WHITE = "\u001b[1;37m" +def useColors(): + if os.environ.get("WYPP_FORCE_COLORS") == "True": + return True + if "NO_COLOR" in os.environ: + return False + if not sys.stdout.isatty(): + return False + if os.environ.get("TERM") == "dumb": + return False + return True + def color(s, color): - return color + s + RESET + if useColors(): + return color + s + RESET + else: + return s def green(s): return color(s, GREEN + BOLD) diff --git a/python/fileTestsLib.py b/python/fileTestsLib.py index 87e02e5..9f11d4c 100644 --- a/python/fileTestsLib.py +++ b/python/fileTestsLib.py @@ -253,6 +253,7 @@ def _runTest(testFile: str, env = os.environ.copy() env['PYTHONPATH'] = os.pathsep.join([os.path.join(ctx.opts.baseDir, 'code')] + pythonPath) env['WYPP_UNDER_TEST'] = 'True' + env['WYPP_FORCE_COLORS'] = 'True' debug(' '.join(cmd)) with open(actualStdoutFile, 'w') as stdoutFile, \ open(actualStderrFile, 'w') as stderrFile: