Ejemplo n.º 1
0
    def _create_core_file(self, config_root, path):
        """
        Creates a core file in a configuration.

        :param str config_root_name: Path to the configuration root.
        :param str path: Path to write in the interpreter file.
        """
        self.create_file(
            ShotgunPath.get_file_name_from_template(
                os.path.join(config_root, "install", "core", "core_%s.cfg")),
            path)
Ejemplo n.º 2
0
    def test_current_platform_file(self):
        """
        Ensures the get_file_name_from_template subtitutes the OS name correctly.
        """
        self.assertEqual(
            ShotgunPath.get_file_name_from_template(r"C:\%s.yml", "win32"),
            r"C:\Windows.yml"
        )

        self.assertEqual(
            ShotgunPath.get_file_name_from_template("/%s.yml", "linux2"),
            "/Linux.yml"
        )

        self.assertEqual(
            ShotgunPath.get_file_name_from_template("/%s.yml", "linux3"),
            "/Linux.yml"
        )

        self.assertEqual(
            ShotgunPath.get_file_name_from_template("/%s.yml", "darwin"),
            "/Darwin.yml"
        )

        with self.assertRaisesRegexp(
            ValueError,
            "Cannot resolve file name - unsupported os platform 'potato'"
        ):
            ShotgunPath.get_file_name_from_template("/%s.yml", "potato")
Ejemplo n.º 3
0
    def test_current_platform_file(self):
        """
        Ensures the get_file_name_from_template subtitutes the OS name correctly.
        """
        self.assertEqual(
            ShotgunPath.get_file_name_from_template(r"C:\%s.yml", "win32"),
            r"C:\Windows.yml",
        )

        self.assertEqual(
            ShotgunPath.get_file_name_from_template("/%s.yml", "linux2"),
            "/Linux.yml")

        self.assertEqual(
            ShotgunPath.get_file_name_from_template("/%s.yml", "linux3"),
            "/Linux.yml")

        self.assertEqual(
            ShotgunPath.get_file_name_from_template("/%s.yml", "darwin"),
            "/Darwin.yml")

        with self.assertRaisesRegex(
                ValueError,
                "Cannot resolve file name - unsupported os platform 'potato'"):
            ShotgunPath.get_file_name_from_template("/%s.yml", "potato")
    def _create_core_file(self, config_root, path):
        """
        Creates a core file in a configuration.

        :param str config_root_name: Path to the configuration root.
        :param str path: Path to write in the interpreter file.
        """
        self.create_file(
            ShotgunPath.get_file_name_from_template(
                os.path.join(
                    config_root, "install", "core",
                    "core_%s.cfg"
                )
            ),
            path
        )