fixed tests

This commit is contained in:
Walter Boring 2026-01-27 16:03:40 -05:00
parent f7138f4cab
commit 29417beab3
7 changed files with 75 additions and 24 deletions

View File

@ -2,6 +2,5 @@ from oslo_config import cfg
from aprsd_slack_plugin.conf import slack
CONF = cfg.CONF
slack.register_opts(CONF)

View File

@ -31,7 +31,6 @@ import importlib
import os
import pkgutil
LIST_OPTS_FUNC_NAME = "list_opts"
@ -65,8 +64,8 @@ def _import_modules(module_names):
mod = importlib.import_module("aprsd_slack_plugin.conf." + modname)
if not hasattr(mod, LIST_OPTS_FUNC_NAME):
msg = (
"The module 'aprsd_slack_plugin.conf.%s' should have a '%s' "
"function which returns the config options." % (modname, LIST_OPTS_FUNC_NAME)
f"The module 'aprsd_slack_plugin.conf.{modname}' should have a "
f"'{LIST_OPTS_FUNC_NAME}' function which returns the config options."
)
raise Exception(msg)
else:

View File

@ -1,6 +1,5 @@
from oslo_config import cfg
slack_group = cfg.OptGroup(
name="aprsd_slack_plugin",
title="APRSD Slack Plugin settings",

View File

@ -111,10 +111,7 @@ class SlackLocationPlugin(
callsign_url = f"<http://aprs.fi/info/a/{searchcall}|{searchcall}>"
aprs_url = (
"<http://aprs.fi/#!mt=roadmap&z=15&lat={}&lng={}| http://aprs.fi/>".format(
lat,
lon,
)
f"<http://aprs.fi/#!mt=roadmap&z=15&lat={lat}&lng={lon}| http://aprs.fi/>"
)
message = {}

View File

@ -4,9 +4,10 @@ from aprsd import packets, plugin
from oslo_config import cfg
import aprsd_slack_plugin
from aprsd_slack_plugin import base_plugin
from aprsd_slack_plugin import conf # noqa
from aprsd_slack_plugin import (
base_plugin,
conf, # noqa
)
CONF = cfg.CONF
LOG = logging.getLogger("APRSD")

View File

@ -1,6 +1,3 @@
[build-system]
requires = ["setuptools>=46.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "aprsd_slack_plugin"
@ -39,16 +36,14 @@ dev = [
"pip-tools",
]
[project.entry-points]
"oslo.config.opts" = { "aprsd_slack_plugin.conf" = "aprsd_slack_plugin.conf.opts:list_opts" }
[project.entry-points."oslo.config.opts"]
"aprsd_slack_plugin.conf" = "aprsd_slack_plugin.conf.opts:list_opts"
[tool.setuptools]
py-modules = ["aprsd_slack_plugin"]
package-data = {aprsd_slack_plugin = ["*.dat"]}
packages = ["aprsd_slack_plugin"]
[tool.setuptools.package-data]
aprsd_slack_plugin = ["py.typed"]
[tool.isort]
profile = "black"
line_length = 99
@ -59,9 +54,62 @@ skip_gitignore = true
# If you need to skip/exclude folders, consider using skip_glob as that will allow the
# isort defaults for skip to remain without the need to duplicate them.
[tool.coverage.run]
branch = true
[tool.mypy]
ignore_missing_imports = true
strict = true
[build-system]
requires = [
"setuptools>=80.0",
"setuptools_scm>=0",
"wheel",
]
build-backend = "setuptools.build_meta"
[tool.ruff]
line-length = 88
target-version = "py311"
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
]
ignore = [
"E501", # line too long (handled by formatter)
]
[tool.ruff.lint.isort]
force-sort-within-sections = true
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
"-ra",
"--strict-markers",
"--strict-config",
"--cov=aprsd_slack_plugin",
"--cov-report=term-missing",
"--cov-report=html",
]
[tool.coverage.run]
branch = true
source = ["aprsd_slack_plugin"]
omit = [
"*/tests/*",
"*/test_*.py",
]
[tool.setuptools_scm]

View File

@ -23,6 +23,7 @@ isolated_build = true
package = editable
deps =
pytest
pytest-cov
aprsd
commands =
# Use -bb to enable BytesWarnings as error to catch str/bytes misuse.
@ -45,6 +46,13 @@ deps =
commands =
uv run ruff check aprsd_slack_plugin tests
[testenv:fmt]
skip_install = true
deps =
ruff
commands =
uv run ruff format aprsd_slack_plugin tests
[testenv:docs]
package = editable
deps =