コード例 #1
0
ファイル: test_utils.py プロジェクト: sunarditay/snapcraft
def _build_environment2_extension_fixture():
    class ExtensionImpl(Extension):
        @staticmethod
        def get_supported_bases() -> Tuple[str, ...]:
            return ("core18", )

        @staticmethod
        def get_supported_confinement() -> Tuple[str, ...]:
            return ("strict", )

        def __init__(self, extension_name, yaml_data):
            super().__init__(extension_name=extension_name,
                             yaml_data=yaml_data)
            self.root_snippet = {}
            self.app_snippet = {}
            self.part_snippet = {
                "after": ["extension-part2"],
                "build-environment": [
                    {
                        "PATH": "$PATH:/extension-path2"
                    },
                    {
                        "EXTKEY": "EXTVAL2"
                    },
                ],
            }
            self.parts = {"extension-part2": {"plugin": "nil"}}

    return fixture_setup.FakeExtension("buildenvironment2", ExtensionImpl)
コード例 #2
0
def _daemon_extension_fixture():
    class DaemonExtension(Extension):
        supported_bases = ("core18", )

        def __init__(self, yaml_data):
            super().__init__(yaml_data)
            self.app_snippet = {"daemon": "simple"}

    return fixture_setup.FakeExtension("daemon", DaemonExtension)
コード例 #3
0
def _plug2_extension_fixture():
    class Plug2Extension(Extension):
        supported_bases = ("core18", )

        def __init__(self, yaml_data):
            super().__init__(yaml_data)
            self.app_snippet = {"plugs": ["test-plug2"]}

    return fixture_setup.FakeExtension("plug2", Plug2Extension)
コード例 #4
0
def _test3_extension_fixture():
    class Test3Extension(Extension):
        supported_bases = ("core16", "core18")

        def __init__(self, yaml_data):
            super().__init__(yaml_data)
            self.parts = {"extension-part": {"plugin": "nil"}}

    return fixture_setup.FakeExtension("test3", Test3Extension)
コード例 #5
0
def _invalid_extension_fixture():
    class InvalidExtension(Extension):
        supported_bases = ("core18", )

        def __init__(self, yaml_data):
            super().__init__(yaml_data)
            self.app_snippet = {"unsupported-key": "value"}

    return fixture_setup.FakeExtension("invalid", InvalidExtension)
コード例 #6
0
def _adopt_info_extension_fixture():
    class AdoptExtension(Extension):
        supported_bases = ("core18", )

        def __init__(self, yaml_data):
            super().__init__(yaml_data)
            self.root_snippet = {"adopt-info": "some-part-name"}

    return fixture_setup.FakeExtension("adopt", AdoptExtension)
コード例 #7
0
def _test2_extension_fixture():
    class Test2Extension(Extension):
        supported_bases = ("core16", )

        def __init__(self, yaml_data):
            super().__init__(yaml_data)
            self.part_snippet = {"after": ["extension-part"]}
            self.parts = {"extension-part": {"plugin": "nil"}}

    return fixture_setup.FakeExtension("test2", Test2Extension)
コード例 #8
0
ファイル: test_utils.py プロジェクト: sergiusens/snapcraft
def _environment_extension_fixture():
    class EnvironmentExtension(Extension):
        supported_bases = ("core18", )

        def __init__(self, yaml_data):
            super().__init__(yaml_data)
            self.app_snippet = {"environment": {"TEST_EXTENSION": 1}}
            self.part_snippet = {"after": ["extension-part"]}
            self.parts = {"extension-part": {"plugin": "nil"}}

    return fixture_setup.FakeExtension("environment", EnvironmentExtension)
コード例 #9
0
def _test1_extension_fixture():
    class Test1Extension(Extension):
        supported_bases = ("core16", )

        def __init__(self, yaml_data):
            super().__init__(yaml_data)
            self.app_snippet = {"environment": {"EXTENSION_NAME": "test1"}}
            self.part_snippet = {"after": ["extension-part"]}
            self.parts = {"extension-part": {"plugin": "nil"}}

    return fixture_setup.FakeExtension("test1", Test1Extension)
コード例 #10
0
ファイル: test_extensions.py プロジェクト: nessita/snapcraft
def _test4_extension_fixture():
    class ExtensionImpl(Extension):
        @staticmethod
        def get_supported_bases() -> Tuple[str, ...]:
            return ("core20", "core18")

        @staticmethod
        def get_supported_confinement() -> Tuple[str, ...]:
            return ("strict",)

        def __init__(self, extension_name, yaml_data):
            super().__init__(extension_name=extension_name, yaml_data=yaml_data)
            self.parts = {"extension-part": {"plugin": "nil"}}

    return fixture_setup.FakeExtension("_test4", ExtensionImpl)
コード例 #11
0
ファイル: test_utils.py プロジェクト: stefanor/snapcraft
def _daemon_extension_fixture():
    class DaemonExtension(Extension):
        @staticmethod
        def get_supported_bases() -> Tuple[str, ...]:
            return ("core18", )

        @staticmethod
        def get_supported_confinement() -> Tuple[str, ...]:
            return ("strict", )

        def __init__(self, extension_name, yaml_data):
            super().__init__(extension_name=extension_name,
                             yaml_data=yaml_data)
            self.app_snippet = {"daemon": "simple"}

    return fixture_setup.FakeExtension("daemon", DaemonExtension)
コード例 #12
0
ファイル: test_utils.py プロジェクト: wting/snapcraft
def _invalid_extension_fixture():
    class ExtensionImpl(Extension):
        @staticmethod
        def get_supported_bases() -> Tuple[str, ...]:
            return ("core18", )

        @staticmethod
        def get_supported_confinement() -> Tuple[str, ...]:
            return ("strict", )

        def __init__(self, extension_name, yaml_data):
            super().__init__(extension_name=extension_name,
                             yaml_data=yaml_data)
            self.app_snippet = {"unsupported-key": "value"}

    return fixture_setup.FakeExtension("invalid", ExtensionImpl)
コード例 #13
0
ファイル: test_utils.py プロジェクト: wting/snapcraft
def _adopt_info_extension_fixture():
    class ExtensionImpl(Extension):
        @staticmethod
        def get_supported_bases() -> Tuple[str, ...]:
            return ("core18", )

        @staticmethod
        def get_supported_confinement() -> Tuple[str, ...]:
            return ("strict", )

        def __init__(self, extension_name, yaml_data):
            super().__init__(extension_name=extension_name,
                             yaml_data=yaml_data)
            self.root_snippet = {"adopt-info": "some-part-name"}

    return fixture_setup.FakeExtension("adopt", ExtensionImpl)
コード例 #14
0
ファイル: test_utils.py プロジェクト: wting/snapcraft
def _plug2_extension_fixture():
    class ExtensionImpl(Extension):
        @staticmethod
        def get_supported_bases() -> Tuple[str, ...]:
            return ("core18", )

        @staticmethod
        def get_supported_confinement() -> Tuple[str, ...]:
            return ("strict", )

        def __init__(self, extension_name, yaml_data):
            super().__init__(extension_name=extension_name,
                             yaml_data=yaml_data)
            self.app_snippet = {"plugs": ["test-plug2"]}

    return fixture_setup.FakeExtension("plug2", ExtensionImpl)
コード例 #15
0
ファイル: test_utils.py プロジェクト: wting/snapcraft
def _environment_extension_fixture():
    class ExtensionImpl(Extension):
        @staticmethod
        def get_supported_bases() -> Tuple[str, ...]:
            return ("core18", )

        @staticmethod
        def get_supported_confinement() -> Tuple[str, ...]:
            return ("strict", )

        def __init__(self, extension_name, yaml_data):
            super().__init__(extension_name=extension_name,
                             yaml_data=yaml_data)
            self.root_snippet = {"environment": {"TEST_EXTENSION": 1}}
            self.app_snippet = {"environment": {"TEST_EXTENSION": 1}}
            self.part_snippet = {"after": ["extension-part"]}
            self.parts = {"extension-part": {"plugin": "nil"}}

    return fixture_setup.FakeExtension("environment", ExtensionImpl)
コード例 #16
0
def _test2_extension_fixture():
    class ExtensionImpl(Extension):
        """This is the Test2 extension.

        It does other stuff.
        """
        @staticmethod
        def get_supported_bases() -> Tuple[str, ...]:
            return ("core16", )

        @staticmethod
        def get_supported_confinement() -> Tuple[str, ...]:
            return ("strict", )

        def __init__(self, extension_name, yaml_data):
            super().__init__(extension_name=extension_name,
                             yaml_data=yaml_data)
            self.part_snippet = {"after": ["extension-part"]}
            self.parts = {"extension-part": {"plugin": "nil"}}

    return fixture_setup.FakeExtension("test2", ExtensionImpl)
コード例 #17
0
ファイル: test_extensions.py プロジェクト: stefanor/snapcraft
def _test1_extension_fixture():
    class Test1Extension(Extension):
        """This is the Test1 extension.

        It does stuff.
        """
        @staticmethod
        def get_supported_bases() -> Tuple[str, ...]:
            return ("core16", )

        @staticmethod
        def get_supported_confinement() -> Tuple[str, ...]:
            return ("strict", )

        def __init__(self, extension_name, yaml_data):
            super().__init__(extension_name=extension_name,
                             yaml_data=yaml_data)
            self.app_snippet = {"environment": {"EXTENSION_NAME": "test1"}}
            self.part_snippet = {"after": ["extension-part"]}
            self.parts = {"extension-part": {"plugin": "nil"}}

    return fixture_setup.FakeExtension("test1", Test1Extension)