build: linting exception defaults
This commit is contained in:
parent
c43a99045a
commit
7433a8926f
4 changed files with 19 additions and 18 deletions
|
@ -1,8 +0,0 @@
|
|||
[MESSAGES CONTROL]
|
||||
disable=broad-except,
|
||||
broad-exception-raised,
|
||||
consider-using-f-string,
|
||||
consider-using-with,
|
||||
invalid-name,
|
||||
missing-function-docstring,
|
||||
missing-module-docstring,
|
4
main.py
4
main.py
|
@ -45,8 +45,8 @@ def get_client(token: str) -> slack_sdk.WebClient:
|
|||
|
||||
def parse_duration(duration: str) -> int:
|
||||
"""Parses duration descriptors of the form xdyhzm (x,y,z integers) into timestamps relative to present."""
|
||||
durationPattern = re.compile(r"(?P<days>\d+d)?(?P<hours>\d+h)?(?P<minutes>\d+m)?")
|
||||
matches = durationPattern.search(duration)
|
||||
duration_pattern = re.compile(r"(?P<days>\d+d)?(?P<hours>\d+h)?(?P<minutes>\d+m)?")
|
||||
matches = duration_pattern.search(duration)
|
||||
|
||||
delta = datetime.timedelta()
|
||||
|
||||
|
|
|
@ -27,3 +27,12 @@ dev = [
|
|||
|
||||
[project.scripts]
|
||||
slck = "main:run"
|
||||
|
||||
[tool.pylint.main]
|
||||
disable = [
|
||||
"line-too-long",
|
||||
"too-few-public-methods",
|
||||
"missing-function-docstring",
|
||||
"missing-module-docstring",
|
||||
"broad-exception-caught"
|
||||
]
|
||||
|
|
16
test.py
16
test.py
|
@ -8,7 +8,7 @@ from click.testing import CliRunner
|
|||
from main import cli, get_configuration, parse_duration
|
||||
|
||||
|
||||
@pytest.fixture(name="with_sample_config")
|
||||
@pytest.fixture(name="with_sample_config", autouse=True)
|
||||
def fixture_with_sample_config(tmp_path):
|
||||
config_path = tmp_path / "config.yml"
|
||||
config_path.write_text(
|
||||
|
@ -67,7 +67,7 @@ presets:
|
|||
assert conf.presets["test"].emoji == ":tada:"
|
||||
|
||||
|
||||
def test_cli_requires_text_or_preset_input(tmp_path, with_sample_config):
|
||||
def test_cli_requires_text_or_preset_input(tmp_path):
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(cli, ["--config", tmp_path / "config.yml"])
|
||||
|
||||
|
@ -78,7 +78,7 @@ def test_cli_requires_text_or_preset_input(tmp_path, with_sample_config):
|
|||
)
|
||||
|
||||
|
||||
def test_cli_overrides_preset_with_text_input(with_sample_config, tmp_path):
|
||||
def test_cli_overrides_preset_with_text_input(tmp_path):
|
||||
runner = CliRunner()
|
||||
|
||||
mock_client = Mock()
|
||||
|
@ -103,7 +103,7 @@ def test_cli_overrides_preset_with_text_input(with_sample_config, tmp_path):
|
|||
assert call_args.kwargs["profile"]["status_emoji"] == ":tada:"
|
||||
|
||||
|
||||
def test_cli_overrides_preset_with_emoji_input(with_sample_config, tmp_path):
|
||||
def test_cli_overrides_preset_with_emoji_input(tmp_path):
|
||||
runner = CliRunner()
|
||||
|
||||
mock_client = Mock()
|
||||
|
@ -129,7 +129,7 @@ def test_cli_overrides_preset_with_emoji_input(with_sample_config, tmp_path):
|
|||
|
||||
|
||||
@freezegun.freeze_time("2012-01-01")
|
||||
def test_cli_overrides_preset_with_exp_input(with_sample_config, tmp_path):
|
||||
def test_cli_overrides_preset_with_exp_input(tmp_path):
|
||||
runner = CliRunner()
|
||||
|
||||
mock_client = Mock()
|
||||
|
@ -158,7 +158,7 @@ def test_cli_overrides_preset_with_exp_input(with_sample_config, tmp_path):
|
|||
)
|
||||
|
||||
|
||||
def test_cli_raises_if_noexist_preset(tmp_path, with_sample_config):
|
||||
def test_cli_raises_if_noexist_preset(tmp_path):
|
||||
runner = CliRunner()
|
||||
|
||||
mock_client = Mock()
|
||||
|
@ -172,7 +172,7 @@ def test_cli_raises_if_noexist_preset(tmp_path, with_sample_config):
|
|||
assert str(result.exception) == "Unknown preset: not-a-preset"
|
||||
|
||||
|
||||
def test_cli_sends_request_to_slack(tmp_path, with_sample_config):
|
||||
def test_cli_sends_request_to_slack(tmp_path):
|
||||
runner = CliRunner()
|
||||
|
||||
mock_client = Mock()
|
||||
|
@ -193,7 +193,7 @@ def test_cli_sends_request_to_slack(tmp_path, with_sample_config):
|
|||
mock_client.users_profile_set.assert_called()
|
||||
|
||||
|
||||
def test_cli_raises_if_api_error(tmp_path, with_sample_config):
|
||||
def test_cli_raises_if_api_error(tmp_path):
|
||||
runner = CliRunner()
|
||||
|
||||
mock_client = Mock()
|
||||
|
|
Loading…
Reference in a new issue