Skip to content

Commit

Permalink
Delay app initialization (#2642)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Oct 31, 2022
1 parent 61d83b0 commit e5a256a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ansiblelint/__main__.py
Expand Up @@ -196,7 +196,6 @@ def main(argv: list[str] | None = None) -> int: # noqa: C901
_logger.debug("Options: %s", options)
_logger.debug(os.getcwd())

app = get_app(offline=options.offline)
# pylint: disable=import-outside-toplevel
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import _get_matches
Expand All @@ -212,6 +211,7 @@ def main(argv: list[str] | None = None) -> int: # noqa: C901
if options.listrules or options.listtags:
return _do_list(rules)

app = get_app(offline=options.offline)
if isinstance(options.tags, str):
options.tags = options.tags.split(",")
result = _get_matches(rules, options)
Expand Down
2 changes: 2 additions & 0 deletions test/test_examples.py
Expand Up @@ -5,6 +5,7 @@
import pytest
from _pytest.fixtures import FixtureRequest

from ansiblelint.app import get_app
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
from ansiblelint.testing import run_ansible_lint
Expand Down Expand Up @@ -49,6 +50,7 @@ def test_example_syntax_error(

def test_example_custom_module(default_rules_collection: RulesCollection) -> None:
"""custom_module.yml is expected to pass."""
get_app(offline=True)
result = Runner(
"examples/playbooks/custom_module.yml", rules=default_rules_collection
).run()
Expand Down

0 comments on commit e5a256a

Please sign in to comment.