diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index f0ad13f..3c4f149 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -105,9 +105,11 @@ jobs: run: | cp libs/audio/libaudio.so . 2>/dev/null || echo "libaudio not found" - - name: Run tests - run: uv run pytest test/libs/ -v --tb=short + - name: Run tests (excluding audio tests) + run: uv run pytest test/libs/ -v --tb=short --color=yes --ignore=test/libs/test_audio.py continue-on-error: false + env: + PYTHONPATH: ${{ github.workspace }} - name: Build Executable shell: bash diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 36703a4..9bdcb55 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -100,8 +100,8 @@ jobs: - name: Install dependencies run: uv sync - - name: Run tests - run: uv run pytest test/libs/ -v --tb=short --color=yes + - name: Run tests (excluding audio tests) + run: uv run pytest test/libs/ -v --tb=short --color=yes --ignore=test/libs/test_audio.py continue-on-error: false env: PYTHONPATH: ${{ github.workspace }} diff --git a/pyproject.toml b/pyproject.toml index 9a91024..ee4310c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,27 +29,6 @@ markers = [ "integration: marks tests as integration tests", ] -[tool.coverage.run] -source = ["libs"] -omit = [ - "*/test/*", - "*/__pycache__/*", - "*/venv/*", - "*/.venv/*", -] - -[tool.coverage.report] -exclude_lines = [ - "pragma: no cover", - "def __repr__", - "raise AssertionError", - "raise NotImplementedError", - "if __name__ == .__main__.:", - "if TYPE_CHECKING:", - "class .*\\bProtocol\\):", - "@(abc\\.)?abstractmethod", -] - [tool.vulture] exclude = ["*.git", ".github/", ".venv/", "cache/"] paths = ["."] diff --git a/test/libs/test_audio.py b/test/libs/test_audio.py index f1e3599..5b4d390 100644 --- a/test/libs/test_audio.py +++ b/test/libs/test_audio.py @@ -69,7 +69,7 @@ class TestAudioEngine(unittest.TestCase): self.mock_config_path = self.sounds_dir # Store original audio singleton state to avoid test pollution self._original_audio_sounds_path = audio.sounds_path - + def tearDown(self): """Tear down each test.""" # Restore original audio singleton state @@ -105,7 +105,7 @@ class TestAudioEngine(unittest.TestCase): mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + # Initialize success = engine.init_audio_device() @@ -122,7 +122,7 @@ class TestAudioEngine(unittest.TestCase): """Test master volume control.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): try: @@ -147,7 +147,7 @@ class TestAudioEngine(unittest.TestCase): """Test loading and unloading sounds.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): try: @@ -169,7 +169,7 @@ class TestAudioEngine(unittest.TestCase): """Test loading a non-existent sound file.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): try: @@ -184,7 +184,7 @@ class TestAudioEngine(unittest.TestCase): """Test playing and stopping sounds.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): try: @@ -214,7 +214,7 @@ class TestAudioEngine(unittest.TestCase): """Test playing the special don and kat sounds.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): try: @@ -238,7 +238,7 @@ class TestAudioEngine(unittest.TestCase): """Test setting sound volume.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): try: @@ -257,7 +257,7 @@ class TestAudioEngine(unittest.TestCase): """Test setting sound pan.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): try: @@ -277,7 +277,7 @@ class TestAudioEngine(unittest.TestCase): """Test loading sounds for a screen.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): try: @@ -298,7 +298,7 @@ class TestAudioEngine(unittest.TestCase): """Test unloading all sounds.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): try: @@ -321,7 +321,7 @@ class TestAudioEngine(unittest.TestCase): """Test loading and playing music streams.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): try: @@ -353,7 +353,7 @@ class TestAudioEngine(unittest.TestCase): """Test getting music time length and played.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): try: @@ -384,7 +384,7 @@ class TestAudioEngine(unittest.TestCase): """Test setting music volume.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): try: @@ -402,7 +402,7 @@ class TestAudioEngine(unittest.TestCase): """Test seeking in music stream.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): try: @@ -420,7 +420,7 @@ class TestAudioEngine(unittest.TestCase): """Test unloading music stream.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): @@ -441,7 +441,7 @@ class TestAudioEngine(unittest.TestCase): """Test unloading all music streams.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): try: @@ -463,7 +463,7 @@ class TestAudioEngine(unittest.TestCase): """Test host API query functions.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + engine.init_audio_device() # List host APIs (should not crash) @@ -478,7 +478,7 @@ class TestAudioEngine(unittest.TestCase): """Test complete audio engine lifecycle.""" mock_config.return_value = {"paths": {"skin": f"{self.sounds_dir}"}} engine = AudioEngine(0, 44100.0, 512, self.volume_presets, sounds_path=self.sounds_dir) - engine.set_log_level(10) + if engine.init_audio_device(): try: