Add quick test runner and enhance run_tests script
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
- Introduced `quick_test.py` for running specific test categories (unit, integration, theme, all). - Updated `run_tests.py` to improve test execution and reporting, including coverage. - Removed outdated test scripts for keyboard shortcuts, menu theming, note saving, and entry updating. - Added new test script `test_theme_changing.py` to verify theme changing functionality. - Consolidated integration tests into `test_integration.py` for comprehensive testing of TheChart application. - Updated theme manager to ensure color retrieval works correctly. - Modified test constants to import from the correct module path.
This commit is contained in:
@@ -18,10 +18,11 @@ class TestConstants:
|
||||
import importlib
|
||||
if 'constants' in sys.modules:
|
||||
importlib.reload(sys.modules['constants'])
|
||||
import constants
|
||||
else:
|
||||
import src.constants
|
||||
import constants
|
||||
|
||||
assert src.constants.LOG_LEVEL == "INFO"
|
||||
assert constants.LOG_LEVEL == "INFO"
|
||||
|
||||
def test_custom_log_level(self):
|
||||
"""Test custom LOG_LEVEL from environment."""
|
||||
@@ -29,10 +30,11 @@ class TestConstants:
|
||||
import importlib
|
||||
if 'constants' in sys.modules:
|
||||
importlib.reload(sys.modules['constants'])
|
||||
import constants
|
||||
else:
|
||||
import src.constants
|
||||
import constants
|
||||
|
||||
assert src.constants.LOG_LEVEL == "DEBUG"
|
||||
assert constants.LOG_LEVEL == "DEBUG"
|
||||
|
||||
def test_default_log_path(self):
|
||||
"""Test default LOG_PATH when not set in environment."""
|
||||
@@ -41,9 +43,9 @@ class TestConstants:
|
||||
if 'constants' in sys.modules:
|
||||
importlib.reload(sys.modules['constants'])
|
||||
else:
|
||||
import src.constants
|
||||
import constants
|
||||
|
||||
assert src.constants.LOG_PATH == "/tmp/logs/thechart"
|
||||
assert constants.LOG_PATH == "/tmp/logs/thechart"
|
||||
|
||||
def test_custom_log_path(self):
|
||||
"""Test custom LOG_PATH from environment."""
|
||||
@@ -52,9 +54,9 @@ class TestConstants:
|
||||
if 'constants' in sys.modules:
|
||||
importlib.reload(sys.modules['constants'])
|
||||
else:
|
||||
import src.constants
|
||||
import constants
|
||||
|
||||
assert src.constants.LOG_PATH == "/custom/log/path"
|
||||
assert constants.LOG_PATH == "/custom/log/path"
|
||||
|
||||
def test_default_log_clear(self):
|
||||
"""Test default LOG_CLEAR when not set in environment."""
|
||||
@@ -63,9 +65,9 @@ class TestConstants:
|
||||
if 'constants' in sys.modules:
|
||||
importlib.reload(sys.modules['constants'])
|
||||
else:
|
||||
import src.constants
|
||||
import constants
|
||||
|
||||
assert src.constants.LOG_CLEAR == "False"
|
||||
assert constants.LOG_CLEAR == "False"
|
||||
|
||||
def test_custom_log_clear_true(self):
|
||||
"""Test LOG_CLEAR when set to true in environment."""
|
||||
@@ -74,9 +76,9 @@ class TestConstants:
|
||||
if 'constants' in sys.modules:
|
||||
importlib.reload(sys.modules['constants'])
|
||||
else:
|
||||
import src.constants
|
||||
import constants
|
||||
|
||||
assert src.constants.LOG_CLEAR == "True"
|
||||
assert constants.LOG_CLEAR == "True"
|
||||
|
||||
def test_custom_log_clear_false(self):
|
||||
"""Test LOG_CLEAR when set to false in environment."""
|
||||
@@ -85,9 +87,9 @@ class TestConstants:
|
||||
if 'constants' in sys.modules:
|
||||
importlib.reload(sys.modules['constants'])
|
||||
else:
|
||||
import src.constants
|
||||
import constants
|
||||
|
||||
assert src.constants.LOG_CLEAR == "False"
|
||||
assert constants.LOG_CLEAR == "False"
|
||||
|
||||
def test_log_level_case_insensitive(self):
|
||||
"""Test that LOG_LEVEL is converted to uppercase."""
|
||||
@@ -96,9 +98,9 @@ class TestConstants:
|
||||
if 'constants' in sys.modules:
|
||||
importlib.reload(sys.modules['constants'])
|
||||
else:
|
||||
import src.constants
|
||||
import constants
|
||||
|
||||
assert src.constants.LOG_LEVEL == "WARNING"
|
||||
assert constants.LOG_LEVEL == "WARNING"
|
||||
|
||||
def test_dotenv_override(self):
|
||||
"""Test that dotenv override parameter is set to True."""
|
||||
@@ -108,22 +110,22 @@ class TestConstants:
|
||||
if 'constants' in sys.modules:
|
||||
importlib.reload(sys.modules['constants'])
|
||||
else:
|
||||
import src.constants
|
||||
import constants
|
||||
|
||||
mock_load_dotenv.assert_called_once_with(override=True)
|
||||
|
||||
def test_all_constants_are_strings(self):
|
||||
"""Test that all constants are string type."""
|
||||
import src.constants
|
||||
import constants
|
||||
|
||||
assert isinstance(src.constants.LOG_LEVEL, str)
|
||||
assert isinstance(src.constants.LOG_PATH, str)
|
||||
assert isinstance(src.constants.LOG_CLEAR, str)
|
||||
assert isinstance(constants.LOG_LEVEL, str)
|
||||
assert isinstance(constants.LOG_PATH, str)
|
||||
assert isinstance(constants.LOG_CLEAR, str)
|
||||
|
||||
def test_constants_not_empty(self):
|
||||
"""Test that constants are not empty strings."""
|
||||
import src.constants
|
||||
import constants
|
||||
|
||||
assert src.constants.LOG_LEVEL != ""
|
||||
assert src.constants.LOG_PATH != ""
|
||||
assert src.constants.LOG_CLEAR != ""
|
||||
assert constants.LOG_LEVEL != ""
|
||||
assert constants.LOG_PATH != ""
|
||||
assert constants.LOG_CLEAR != ""
|
||||
|
||||
Reference in New Issue
Block a user