Tests: Don't trip over added toddlers
Relax some tests so that they cope with added toddlers without having to update the relevant tests. Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
parent
92b3805fe1
commit
123df084b3
3 changed files with 19 additions and 22 deletions
|
@ -2,17 +2,11 @@ import toddlers.plugins
|
|||
|
||||
|
||||
def test_toddlers_plugins():
|
||||
variables = [var for var in dir(toddlers.plugins) if not var.startswith("__")]
|
||||
assert sorted(variables) == sorted(
|
||||
[
|
||||
"debug",
|
||||
"flag_ci_pr",
|
||||
"flag_commit_build",
|
||||
"here",
|
||||
"importlib",
|
||||
"name",
|
||||
"os",
|
||||
"packager_bugzilla_sync",
|
||||
"pdc_retired_packages",
|
||||
]
|
||||
)
|
||||
plugin_module_names = toddlers.plugins.__all__
|
||||
assert not any(n.startswith("__") for n in plugin_module_names)
|
||||
assert {
|
||||
"flag_ci_pr",
|
||||
"flag_commit_build",
|
||||
"packager_bugzilla_sync",
|
||||
"pdc_retired_packages",
|
||||
} <= set(plugin_module_names)
|
||||
|
|
|
@ -23,14 +23,14 @@ class TestRunningToddler:
|
|||
@patch_messaging_config()
|
||||
def test___init__(self):
|
||||
runner = toddlers.runner.RunningToddler()
|
||||
assert sorted([t.name for t in runner.toddlers]) == sorted(
|
||||
[
|
||||
"flag_ci_pr",
|
||||
"flag_commit_build",
|
||||
"packager_bugzilla_sync",
|
||||
"pdc_retired_packages",
|
||||
]
|
||||
)
|
||||
# Check that at least these toddlers exist (but don't fail
|
||||
# automatically just because new ones are added).
|
||||
assert {
|
||||
"flag_ci_pr",
|
||||
"flag_commit_build",
|
||||
"packager_bugzilla_sync",
|
||||
"pdc_retired_packages",
|
||||
} <= {t.name for t in runner.toddlers}
|
||||
|
||||
@patch_messaging_config()
|
||||
@patch("toddlers.runner.ToddlerBase")
|
||||
|
|
|
@ -2,8 +2,11 @@ import importlib
|
|||
import os
|
||||
|
||||
|
||||
__all__ = [] # fill below
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
for name in os.listdir(here):
|
||||
if name.endswith(".py") and not name.startswith("__"):
|
||||
name = name[:-3]
|
||||
importlib.import_module(f".{name}", package=__name__)
|
||||
__all__.append(name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue