当前位置: 首页>>代码示例>>Python>>正文


Python helpers.ensure_in_syspath函数代码示例

本文整理汇总了Python中salttesting.helpers.ensure_in_syspath函数的典型用法代码示例。如果您正苦于以下问题:Python ensure_in_syspath函数的具体用法?Python ensure_in_syspath怎么用?Python ensure_in_syspath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ensure_in_syspath函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ensure_in_syspath

# -*- coding: utf-8 -*-

# Import python libs
from __future__ import absolute_import

# Import Salt Libs
from salt import acl

# Import Salt Testing Libs
from salttesting import TestCase, skipIf
from salttesting.mock import NO_MOCK, NO_MOCK_REASON
from salttesting.helpers import ensure_in_syspath

ensure_in_syspath("../../")


@skipIf(NO_MOCK, NO_MOCK_REASON)
class ClientACLTestCase(TestCase):
    """
    Unit tests for salt.acl.ClientACL
    """

    def setUp(self):
        self.blacklist = {
            "users": ["joker", "penguin", "*bad_*", "blocked_.*", "^Homer$"],
            "modules": ["cmd.run", "test.fib", "rm-rf.*"],
        }

    def test_user_is_blacklisted(self):
        """
        test user_is_blacklisted
开发者ID:bryson,项目名称:salt,代码行数:31,代码来源:client_test.py

示例2: import

'''

# Import Python Libs
from __future__ import absolute_import

# Import Salt Testing Libs
from salttesting import TestCase, skipIf
from salttesting.helpers import ensure_in_syspath
from salttesting.mock import (
    MagicMock,
    patch,
    NO_MOCK,
    NO_MOCK_REASON
)

ensure_in_syspath('../../')

# Import Salt Libs
from salt.states import iptables

# Globals
iptables.__salt__ = {}
iptables.__opts__ = {}


@skipIf(NO_MOCK, NO_MOCK_REASON)
class IptablesTestCase(TestCase):
    '''
        Validate the iptables state
    '''
    def test_chain_present(self):
开发者ID:shineforever,项目名称:ops,代码行数:31,代码来源:iptables_test.py

示例3: Algarvio

    :codeauthor: :email:`Pedro Algarvio ([email protected])`
    :copyright: © 2013 by the SaltStack Team, see AUTHORS for more details.
    :license: Apache 2.0, see LICENSE for more details.
'''

# Import python libs
import os
import tempfile

# Import salt testing libs
from salttesting.helpers import ensure_in_syspath
from salttesting.parser.cover import SaltCoverageTestingParser

TEST_DIR = os.path.abspath(os.path.dirname(__file__))
SALTCLOUD_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
ensure_in_syspath(SALTCLOUD_ROOT)

XML_OUTPUT_DIR = os.environ.get(
    'XML_TEST_REPORTS', os.path.join(
        tempfile.gettempdir(), 'xml-test-reports'
    )
)
HTML_OUTPUT_DIR = os.environ.get(
    'HTML_OUTPUT_DIR', os.path.join(
        tempfile.gettempdir(), 'html-test-results'
    )
)


try:
    if SALTCLOUD_ROOT:
开发者ID:1mentat,项目名称:salt,代码行数:31,代码来源:runtests.py

示例4: ensure_in_syspath

)
INTEGRATION_TEST_DIR = os.path.dirname(
    os.path.normpath(os.path.abspath(__file__))
)
CODE_DIR = os.path.dirname(os.path.dirname(INTEGRATION_TEST_DIR))
SALT_LIBS = os.path.dirname(CODE_DIR)

# Import Salt Testing libs
from salttesting import TestCase
from salttesting.case import ShellTestCase
from salttesting.mixins import CheckShellBinaryNameAndVersionMixIn
from salttesting.parser import PNUM, print_header, SaltTestcaseParser
from salttesting.helpers import ensure_in_syspath, RedirectStdStreams

# Update sys.path
ensure_in_syspath(CODE_DIR, SALT_LIBS)

# Import Salt libs
import salt
import salt._compat
import salt.config
import salt.master
import salt.minion
import salt.runner
import salt.output
import salt.version
import salt.utils
from salt.utils import fopen, get_colors
from salt.utils.verify import verify_env

# Import 3rd-party libs
开发者ID:bemehow,项目名称:salt,代码行数:31,代码来源:__init__.py

示例5: ensure_in_syspath

# -*- coding: utf-8 -*-

# Import Salt Testing libs
from salttesting import TestCase, skipIf
from salttesting.helpers import ensure_in_syspath
#from salttesting.mock import patch, call, NO_MOCK, NO_MOCK_REASON  #, MagicMock

ensure_in_syspath('../../../_modules')

import profiles

profiles.__salt__ = {}

class ProfilesTestCase(TestCase):

    def test_payloadcontent_to_uuid(self):
        uuid = profiles._content_to_uuid('ABCDEF')
        print(uuid)


if __name__ == '__main__':
    from ..integration import run_tests
    run_tests(ProfilesTestCase, needs_daemon=False)
开发者ID:mosen,项目名称:salt-osx,代码行数:23,代码来源:profiles_test.py

示例6: ensure_in_syspath


    Tests to ensure that the file permissions are set correctly when
    importing from the git repo.
'''

# Import python libs
import os
import stat
import pprint

# Import salt testing libs
from salttesting import TestCase
from salttesting.helpers import ensure_in_syspath

ensure_in_syspath('..')

from integration import CODE_DIR

EXEMPT_DIRS = []
EXEMPT_FILES = [
    'debian/rules',
    'doc/.scripts/compile-translation-catalogs',
    'doc/.scripts/download-translation-catalog',
    'doc/.scripts/setup-transifex-config',
    'doc/.scripts/update-transifex-source-translations',
    'pkg/arch/Makefile',
    'pkg/arch/PKGBUILD',
    'pkg/arch/PKGBUILD-git',
    'pkg/arch/PKGBUILD-local',
    'pkg/arch/git/PKGBUILD',
开发者ID:bemehow,项目名称:salt,代码行数:29,代码来源:perm_test.py

示例7: ensure_in_syspath

# -*- coding: utf-8 -*-

# Import python libs
from __future__ import absolute_import, print_function
import os

# Import Salt Testing libs
from salttesting import skipIf, TestCase
from salttesting.helpers import ensure_in_syspath
from salttesting.mock import NO_MOCK, NO_MOCK_REASON, Mock, patch
ensure_in_syspath(
    os.path.join(os.path.abspath(os.path.dirname(__file__)), '../../../'))
ensure_in_syspath(
    os.path.join(os.path.abspath(os.path.dirname(__file__)), '../../'))

# Import salt libs
from salt.modules import deb_postgres

deb_postgres.__grains__ = None  # in order to stub it w/patch below
deb_postgres.__salt__ = None  # in order to stub it w/patch below


LSCLUSTER = '''\
8.4 main 5432 online postgres /srv/8.4/main \
        /var/log/postgresql/postgresql-8.4-main.log
9.1 main 5433 online postgres /srv/9.1/main \
        /var/log/postgresql/postgresql-9.1-main.log
'''
if NO_MOCK is False:
    SALT_STUB = {
        'config.option': Mock(),
开发者ID:DaveQB,项目名称:salt,代码行数:31,代码来源:deb_postgres_test.py


注:本文中的salttesting.helpers.ensure_in_syspath函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。