blob: 66e8520c3777a36ba319b5482b08a518e81a044c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import pytest
from ansiblelint.runner import Runner
IMPORTED_PLAYBOOK = '''
- hosts: all
tasks:
- name: success
fail: msg="fail"
when: False
'''
MAIN_PLAYBOOK = '''
- hosts: all
tasks:
- name: should be shell # noqa 305 301
shell: echo lol
- import_playbook: imported_playbook.yml
'''
@pytest.fixture
def playbook(tmp_path):
playbook_path = tmp_path / 'playbook.yml'
playbook_path.write_text(MAIN_PLAYBOOK)
(tmp_path / 'imported_playbook.yml').write_text(IMPORTED_PLAYBOOK)
return str(playbook_path)
def test_skip_import_playbook(default_rules_collection, playbook):
runner = Runner(default_rules_collection, playbook, [], [], [])
results = runner.run()
assert len(results) == 0
|