Skip to content

Commit d6a4320

Browse files
Address code review feedback: improve test assertions and Windows compatibility
Co-authored-by: willtheorangeguy <[email protected]>
1 parent ad19917 commit d6a4320

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

.github/workflows/tests.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,19 @@ jobs:
3636
run: |
3737
python -m pip install --upgrade pip
3838
pip install pytest pytest-cov
39+
shell: bash
40+
41+
- name: Install requirements if present
42+
run: |
3943
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
4044
shell: bash
45+
if: runner.os != 'Windows'
46+
47+
- name: Install requirements if present (Windows)
48+
run: |
49+
if (Test-Path requirements.txt) { pip install -r requirements.txt }
50+
shell: pwsh
51+
if: runner.os == 'Windows'
4152

4253
- name: Run tests (Linux)
4354
if: runner.os == 'Linux'

tests/test_main.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
the Free Software Foundation, version 3 of the License.
88
"""
99

10-
# pylint: disable=import-error, invalid-name, unused-argument, wrong-import-position, import-outside-toplevel
10+
# pylint: disable=import-error, invalid-name, wrong-import-position, import-outside-toplevel, unused-argument
11+
# unused-argument is disabled because @patch decorators inject mocked objects as parameters
12+
# even when not all mocks are used in every test
1113

1214
import unittest
1315
from unittest.mock import Mock, patch, mock_open
@@ -157,7 +159,8 @@ def test_programver_creates_window(
157159
mock_tk.assert_called_once()
158160
# Verify window title was set
159161
mock_window.title.assert_called_once()
160-
assert "ProgramVer" in str(mock_window.title.call_args)
162+
title_text = mock_window.title.call_args[0][0]
163+
assert "ProgramVer" in title_text
161164

162165
@patch("main.Tk")
163166
@patch("main.PhotoImage")
@@ -195,9 +198,8 @@ def test_programver_creates_labels(
195198

196199
ProgramVer()
197200

198-
# Verify Label was called multiple times
201+
# Verify Label was called multiple times to create all labels
199202
assert mock_label.call_count >= 5
200-
# Verify labels were created with window
201203

202204
@patch("main.Tk")
203205
@patch("main.PhotoImage")

0 commit comments

Comments
 (0)