feat: add --my-tasks mode for open assigned issues (#71)
List open Redmine issues assigned to the current (or overridden) user, sorted by priority rank (P1..P5) then version due date with a stable id tie-break. Renders an OSC 8 hyperlinked console table on stdout and a counts/hours summary line on stderr; version due dates are fetched once per unique version, unavailable versions degrade to an empty due date. Also migrates the codebase to ruff 0.17.3 defaults (PEP 585/604 annotations, targeted noqa for intentional blind excepts and CLI root logging). Behavior-neutral: 408 tests pass with -W error.
This commit is contained in:
@@ -2,10 +2,10 @@ import contextlib
|
||||
import os
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from typing import ClassVar
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
from redmine_reporter.config import AppConfig, Config, EmailConfig
|
||||
|
||||
|
||||
@@ -194,9 +194,8 @@ class TestDefaultDateRangePeriodFrom:
|
||||
yaml_path.write_text("period:\n from: 'not-a-date'\n")
|
||||
Config._app = AppConfig.from_yaml(yaml_path)
|
||||
|
||||
with caplog.at_level(logging.WARNING):
|
||||
with mock_today(date(2026, 9, 15)):
|
||||
rng = Config.get_default_date_range()
|
||||
with caplog.at_level(logging.WARNING), mock_today(date(2026, 9, 15)):
|
||||
rng = Config.get_default_date_range()
|
||||
|
||||
assert rng == "2026-09-01--2026-09-15"
|
||||
assert "not-a-date" in caplog.text
|
||||
@@ -208,9 +207,8 @@ class TestDefaultDateRangePeriodFrom:
|
||||
from datetime import date
|
||||
|
||||
Config._app = None
|
||||
with caplog.at_level(logging.WARNING):
|
||||
with mock_today(date(2026, 9, 15)):
|
||||
rng = Config.get_default_date_range()
|
||||
with caplog.at_level(logging.WARNING), mock_today(date(2026, 9, 15)):
|
||||
rng = Config.get_default_date_range()
|
||||
|
||||
assert rng == "2026-09-01--2026-09-15"
|
||||
assert "garbage" in caplog.text
|
||||
@@ -296,7 +294,10 @@ class TestConfigRequiresHttpsUrl:
|
||||
class TestWarnWhenTlsVerificationDisabled:
|
||||
"""verify_ssl: false должен давать видимый warning в stderr (риск MITM)."""
|
||||
|
||||
_ENV = {"REDMINE_URL": "https://red.eltex.loc/", "REDMINE_API_KEY": "token"}
|
||||
_ENV: ClassVar[dict[str, str]] = {
|
||||
"REDMINE_URL": "https://red.eltex.loc/",
|
||||
"REDMINE_API_KEY": "token",
|
||||
}
|
||||
|
||||
def _validate_env(self, verify: str):
|
||||
return {**self._ENV, "REDMINE_VERIFY": verify}
|
||||
@@ -661,9 +662,11 @@ class TestConfigYamlFallback:
|
||||
|
||||
Config._app = AppConfig.from_yaml(yaml_path)
|
||||
|
||||
with mock.patch.dict(os.environ, {"FROM_DATE": "2026-07-01"}, clear=True):
|
||||
with mock_today(date(2026, 7, 15)):
|
||||
assert Config.get_default_date_range() == "2026-07-01--2026-07-15"
|
||||
with (
|
||||
mock.patch.dict(os.environ, {"FROM_DATE": "2026-07-01"}, clear=True),
|
||||
mock_today(date(2026, 7, 15)),
|
||||
):
|
||||
assert Config.get_default_date_range() == "2026-07-01--2026-07-15"
|
||||
|
||||
|
||||
class TestGetEmailConfig:
|
||||
|
||||
Reference in New Issue
Block a user