🐛 | Fix SonarQube violations - use items() and remove assert True
All checks were successful
SonarQube Code Quality Scan / SonarQube Scan (push) Successful in 1m42s
All checks were successful
SonarQube Code Quality Scan / SonarQube Scan (push) Successful in 1m42s
This commit is contained in:
@@ -144,11 +144,11 @@ def _install_stubs() -> None:
|
|||||||
(MOD_QTWIDGETS, "QSizePolicy"): _stub("QSizePolicy"),
|
(MOD_QTWIDGETS, "QSizePolicy"): _stub("QSizePolicy"),
|
||||||
}
|
}
|
||||||
|
|
||||||
for mod_name, attr_name in _PYSIDE_STUBS:
|
for (mod_name, attr_name), stub_value in _PYSIDE_STUBS.items():
|
||||||
if mod_name not in sys.modules:
|
if mod_name not in sys.modules:
|
||||||
mod = mock.MagicMock(__name__=mod_name.rsplit(".", 1)[-1])
|
mod = mock.MagicMock(__name__=mod_name.rsplit(".", 1)[-1])
|
||||||
sys.modules[mod_name] = mod
|
sys.modules[mod_name] = mod
|
||||||
setattr(sys.modules[mod_name], attr_name, _PYSIDE_STUBS[(mod_name, attr_name)])
|
setattr(sys.modules[mod_name], attr_name, stub_value)
|
||||||
|
|
||||||
# ── yt-dlp ─────────────────────────────────────────────────────────
|
# ── yt-dlp ─────────────────────────────────────────────────────────
|
||||||
if "yt_dlp" not in sys.modules:
|
if "yt_dlp" not in sys.modules:
|
||||||
|
|||||||
@@ -230,7 +230,6 @@ class TestDiscordRPC:
|
|||||||
drpc._start_ts = 1000
|
drpc._start_ts = 1000
|
||||||
# Should not crash
|
# Should not crash
|
||||||
drpc._send_presence()
|
drpc._send_presence()
|
||||||
assert True
|
|
||||||
|
|
||||||
def test_connect_oserror_handled(self):
|
def test_connect_oserror_handled(self):
|
||||||
"""_connect handles OSError gracefully (covers lines 119-122)."""
|
"""_connect handles OSError gracefully (covers lines 119-122)."""
|
||||||
|
|||||||
@@ -301,13 +301,11 @@ class TestCleanupPath:
|
|||||||
"""_cleanup_path does nothing for non-existent paths."""
|
"""_cleanup_path does nothing for non-existent paths."""
|
||||||
fn = self._import()
|
fn = self._import()
|
||||||
fn("/nonexistent/path/file.txt") # should not raise
|
fn("/nonexistent/path/file.txt") # should not raise
|
||||||
assert True
|
|
||||||
|
|
||||||
def test_noop_for_none(self):
|
def test_noop_for_none(self):
|
||||||
"""_cleanup_path does nothing when path is None."""
|
"""_cleanup_path does nothing when path is None."""
|
||||||
fn = self._import()
|
fn = self._import()
|
||||||
fn(None)
|
fn(None)
|
||||||
assert True
|
|
||||||
|
|
||||||
def test_oserror_handled_gracefully(self, tmp_path, monkeypatch):
|
def test_oserror_handled_gracefully(self, tmp_path, monkeypatch):
|
||||||
"""_cleanup_path handles OSError gracefully."""
|
"""_cleanup_path handles OSError gracefully."""
|
||||||
@@ -320,7 +318,6 @@ class TestCleanupPath:
|
|||||||
|
|
||||||
monkeypatch.setattr(os, "unlink", _fail_unlink)
|
monkeypatch.setattr(os, "unlink", _fail_unlink)
|
||||||
fn(str(path)) # should not raise
|
fn(str(path)) # should not raise
|
||||||
assert True
|
|
||||||
|
|
||||||
|
|
||||||
# ── _tmp_dir ───────────────────────────────────────────────────────────────────
|
# ── _tmp_dir ───────────────────────────────────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user