本文整理汇总了Python中ansiblelint.Runner.run方法的典型用法代码示例。如果您正苦于以下问题:Python Runner.run方法的具体用法?Python Runner.run怎么用?Python Runner.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ansiblelint.Runner
的用法示例。
在下文中一共展示了Runner.run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_files_not_scanned_twice
# 需要导入模块: from ansiblelint import Runner [as 别名]
# 或者: from ansiblelint.Runner import run [as 别名]
def test_files_not_scanned_twice(self):
checked_files = set()
filename = os.path.abspath('test/common-include-1.yml')
runner = Runner(self.rules, filename, [], [], [], 0, checked_files)
run1 = runner.run()
filename = os.path.abspath('test/common-include-2.yml')
runner = Runner(self.rules, filename, [], [], [], 0, checked_files)
run2 = runner.run()
assert ((len(run1) + len(run2)) == 1)
示例2: test_runner_encrypted_secrets
# 需要导入模块: from ansiblelint import Runner [as 别名]
# 或者: from ansiblelint.Runner import run [as 别名]
def test_runner_encrypted_secrets(self):
from pkg_resources import parse_version
import ansible
# Only run this test for ansible 2.3+
# It checks ansible-lint's parsing of yaml files that contain
# encrypted secrets.
if parse_version(ansible.__version__) >= parse_version('2.3'):
filename = 'test/contains_secrets.yml'
runner = Runner(self.rules, filename, [], [], [])
assert (len(runner.run()) == 0)
示例3: test_import_role_inline_args
# 需要导入模块: from ansiblelint import Runner [as 别名]
# 或者: from ansiblelint.Runner import run [as 别名]
def test_import_role_inline_args(self):
fh = self._get_play_file(PLAY_IMPORT_ROLE_INLINE)
runner = Runner(self.rules, fh.name, [], [], [])
results = runner.run()
assert 'only when shell functionality is required' in str(results)
示例4: test_file_negative
# 需要导入模块: from ansiblelint import Runner [as 别名]
# 或者: from ansiblelint.Runner import run [as 别名]
def test_file_negative(self):
failure = 'test/become-user-without-become-failure.yml'
bad_runner = Runner(self.collection, failure, [], [], [])
errs = bad_runner.run()
self.assertEqual(3, len(errs))
示例5: test_file_negative
# 需要导入模块: from ansiblelint import Runner [as 别名]
# 或者: from ansiblelint.Runner import run [as 别名]
def test_file_negative(self):
failure = 'test/octalpermissions-failure.yml'
bad_runner = Runner(self.collection, failure, [], [], [])
errs = bad_runner.run()
self.assertEqual(4, len(errs))
示例6: test_positive_skip_tag
# 需要导入模块: from ansiblelint import Runner [as 别名]
# 或者: from ansiblelint.Runner import run [as 别名]
def test_positive_skip_tag(self):
skip_tag = 'ANSIBLE0002'
good_runner = Runner(self.collection, self.file, [], [skip_tag], [])
self.assertEqual([], good_runner.run())
示例7: test_negative_with_tag
# 需要导入模块: from ansiblelint import Runner [as 别名]
# 或者: from ansiblelint.Runner import run [as 别名]
def test_negative_with_tag(self):
with_tag = 'ANSIBLE0002'
bad_runner = Runner(self.collection, self.file, [with_tag], [], [])
errs = bad_runner.run()
self.assertGreater(len(errs), 0)
示例8: test_negative_no_param
# 需要导入模块: from ansiblelint import Runner [as 别名]
# 或者: from ansiblelint.Runner import run [as 别名]
def test_negative_no_param(self):
bad_runner = Runner(self.collection, self.file, [], [], [])
errs = bad_runner.run()
self.assertGreater(len(errs), 0)
示例9: test_file_negative
# 需要导入模块: from ansiblelint import Runner [as 别名]
# 或者: from ansiblelint.Runner import run [as 别名]
def test_file_negative(self):
failure = 'test/use-handler-rather-than-when-changed-failure.yml'
bad_runner = Runner(self.collection, failure, [], [], [])
errs = bad_runner.run()
self.assertEqual(5, len(errs))
示例10: test_file_positive
# 需要导入模块: from ansiblelint import Runner [as 别名]
# 或者: from ansiblelint.Runner import run [as 别名]
def test_file_positive(self):
success = 'test/use-handler-rather-than-when-changed-success.yml'
good_runner = Runner(self.collection, success, [], [], [])
self.assertEqual([], good_runner.run())
示例11: test_gitlab_dependency_is_ok
# 需要导入模块: from ansiblelint import Runner [as 别名]
# 或者: from ansiblelint.Runner import run [as 别名]
def test_gitlab_dependency_is_ok(self):
filename = 'test/dependency-in-meta/gitlab.yml'
good_runner = Runner(self.rules, filename, [], [], [])
self.assertEqual([], good_runner.run())
示例12: test_runner_empty_tags_count
# 需要导入模块: from ansiblelint import Runner [as 别名]
# 或者: from ansiblelint.Runner import run [as 别名]
def test_runner_empty_tags_count(self):
filename = 'test/emptytags.yml'
runner = Runner(self.rules, filename, [], [], [])
assert (len(runner.run()) == 0)
示例13: test_runner_become_count
# 需要导入模块: from ansiblelint import Runner [as 别名]
# 或者: from ansiblelint.Runner import run [as 别名]
def test_runner_become_count(self):
filename = 'test/become.yml'
runner = Runner(self.rules, filename, [], [], [])
assert (len(runner.run()) == 0)
示例14: test_runner_excludes_paths
# 需要导入模块: from ansiblelint import Runner [as 别名]
# 或者: from ansiblelint.Runner import run [as 别名]
def test_runner_excludes_paths(self):
filename = 'examples/lots_of_warnings.yml'
excludes = ['examples/lots_of_warnings.yml']
runner = Runner(self.rules, filename, [], [], excludes)
assert (len(runner.run()) == 0)
示例15: test_file_negative
# 需要导入模块: from ansiblelint import Runner [as 别名]
# 或者: from ansiblelint.Runner import run [as 别名]
def test_file_negative(self):
failure = 'test/env-vars-in-command-failure.yml'
bad_runner = Runner(self.collection, failure, [], [], [])
errs = bad_runner.run()
self.assertEqual(2, len(errs))