From 0632246f502bfa9713da19ba23ab0c71f7215f24 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Tue, 10 Feb 2026 23:49:28 +0100 Subject: [PATCH] Simplify --- .../com.micropythonos.about/assets/about.py | 2 +- internal_filesystem/lib/logging/__init__.py | 1 + tests/test_logging.py | 18 +----------------- tests/test_multi_websocket_with_bad_ones.py | 5 +---- 4 files changed, 4 insertions(+), 22 deletions(-) create mode 100644 internal_filesystem/lib/logging/__init__.py diff --git a/internal_filesystem/builtin/apps/com.micropythonos.about/assets/about.py b/internal_filesystem/builtin/apps/com.micropythonos.about/assets/about.py index 83b29c87..765b7bbd 100644 --- a/internal_filesystem/builtin/apps/com.micropythonos.about/assets/about.py +++ b/internal_filesystem/builtin/apps/com.micropythonos.about/assets/about.py @@ -1,5 +1,5 @@ import sys -import logging.logging as logging +import logging from mpos import Activity, DisplayMetrics, BuildInfo, DeviceInfo diff --git a/internal_filesystem/lib/logging/__init__.py b/internal_filesystem/lib/logging/__init__.py new file mode 100644 index 00000000..e060b377 --- /dev/null +++ b/internal_filesystem/lib/logging/__init__.py @@ -0,0 +1 @@ +from .logging import * diff --git a/tests/test_logging.py b/tests/test_logging.py index 6cc443f8..72a68b7f 100644 --- a/tests/test_logging.py +++ b/tests/test_logging.py @@ -3,27 +3,14 @@ import unittest import sys import io -import logging.logging as logging +import logging # Add lib to path so we can import logging sys.path.insert(0, 'MicroPythonOS/internal_filesystem/lib') - class TestLoggingLevels(unittest.TestCase): """Test that logger levels work correctly with handlers.""" - def setUp(self): - """Set up test fixtures.""" - # Clear any existing loggers - logging._loggers.clear() - # Reset basicConfig - logging.basicConfig(force=True) - - def tearDown(self): - """Clean up after tests.""" - logging.shutdown() - logging._loggers.clear() - def test_child_logger_info_level_with_root_handlers(self): """Test that a child logger can set INFO level and log INFO messages using root handlers.""" # Capture output @@ -146,6 +133,3 @@ class TestLoggingLevels(unittest.TestCase): self.assertTrue("info message" not in output) self.assertTrue("warning message" in output) - -if __name__ == '__main__': - unittest.main() diff --git a/tests/test_multi_websocket_with_bad_ones.py b/tests/test_multi_websocket_with_bad_ones.py index e7b85b9b..5fbda5a7 100644 --- a/tests/test_multi_websocket_with_bad_ones.py +++ b/tests/test_multi_websocket_with_bad_ones.py @@ -7,17 +7,14 @@ from mpos import TaskManager from websocket import WebSocketApp - -# demo_multiple_ws.py import asyncio import aiohttp from aiohttp import WSMsgType -import logging.logging as logging +import logging import sys from typing import List - # ---------------------------------------------------------------------- # Logging # ----------------------------------------------------------------------