Skip to content

Commit

Permalink
Merge pull request #190 from JayBazuzi/dynamic-module-list
Browse files Browse the repository at this point in the history
. t dynamically discover the approvals modules
  • Loading branch information
nitsanavni authored Nov 12, 2024
2 parents 861768b + 8e03e15 commit 6f392dd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
0) approvaltests.approvals
1) approvaltests.combination_approvals
2) approvaltests.integrations.mrjob.mrjob_approvals
3) approvaltests.utilities.command_line_approvals
4) approvaltests.utilities.logger.simple_logger_approvals
5) approvaltests.utilities.logging.logging_approvals
21 changes: 16 additions & 5 deletions tests/test_options.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import importlib
import inspect
import sys

from approvaltests import (
get_default_reporter,
approvals,
verify,
verify_all,
ReporterForTesting,
combination_approvals,
)
Expand All @@ -13,14 +16,22 @@
from approvaltests.reporters.report_with_beyond_compare import ReportWithPycharm
from approvaltests.utilities import command_line_approvals
from approvaltests.utilities.logger import simple_logger_approvals
from approvaltests.utilities.logging import logging_approvals


_approvals_modules = list(sorted(filter(
lambda name: name.startswith("approvaltests.") and name.endswith("approvals"),
sys.modules.keys(),
)))


def test_list_of_modules():
verify_all("", _approvals_modules)


def test_every_function_in_approvals_with_verify_has_an_options():
assert_verify_methods_have_options(approvals)
assert_verify_methods_have_options(combination_approvals)
assert_verify_methods_have_options(simple_logger_approvals)
assert_verify_methods_have_options(command_line_approvals)
assert_verify_methods_have_options(mrjob_approvals)
for module_name in _approvals_modules:
assert_verify_methods_have_options(importlib.import_module(module_name))


def assert_verify_methods_have_options(module):
Expand Down

0 comments on commit 6f392dd

Please sign in to comment.