Пример #1
0
    def text_complex_nospec(self):
        specline = {}
        with self.assertRaises(Exception):
            parse_specline(specline, self.default_envs)

        specline = {"name": "", "spec": ""}
        with self.assertRaises(Exception):
            parse_specline(specline, self.default_envs)
Пример #2
0
    def text_complex_nospec(self):
        specline = {}
        with self.assertRaises(Exception):
            parse_specline(specline, self.default_envs)

        specline = {"name": "", "spec": ""}
        with self.assertRaises(Exception):
            parse_specline(specline, self.default_envs)
Пример #3
0
    def test_complex_overides(self):
        """Checks if override gets merged with overrides """
        specline = {
            "spec": "package==1.2",
            "override": {
                "deps_append": ["dep==1.2"]
            },
            "overrides": {
                "depA": {
                    "deps_append": ["dep2==1.2"]
                }
            }
        }
        result = parse_specline(specline, self.default_envs)

        self.assertEqual(
            result["python2.7"], {
                "name": "package",
                "spec": "package==1.2",
                "overrides": {
                    "package": {
                        "deps_append": ["dep==1.2"]
                    },
                    "depA": {
                        "deps_append": ["dep2==1.2"]
                    }
                },
                "versions": []
            })
Пример #4
0
    def test_simple(self):
        specline = "package==1.2"
        result = parse_specline(specline, self.default_envs)

        self.assertEqual(result, {
            "python2.7": {"name": "package", "spec": "package==1.2"},
            "python3.3": {"name": "package", "spec": "package==1.2"}
        })
Пример #5
0
    def test_complex_versions(self):
        specline = {"spec": "package==1.2", "versions": ["dep1==1.2.3"]}
        result = parse_specline(specline, self.default_envs)
        self.assertEqual(result["python2.7"], {
            "name": "package",
            "spec": "package==1.2",
            "versions": ["dep1==1.2.3"],
            "overrides": {}
        })

        specline = {"spec": "package==1.2", "versions": "dep1==1.2.3"}
        result = parse_specline(specline, self.default_envs)
        self.assertEqual(result["python2.7"], {
            "name": "package",
            "spec": "package==1.2",
            "versions": ["dep1==1.2.3"],
            "overrides": {}
        })
Пример #6
0
    def test_complex_versions(self):
        specline = {"spec": "package==1.2", "versions": ["dep1==1.2.3"]}
        result = parse_specline(specline, self.default_envs)
        self.assertEqual(
            result["python2.7"], {
                "name": "package",
                "spec": "package==1.2",
                "versions": ["dep1==1.2.3"],
                "overrides": {}
            })

        specline = {"spec": "package==1.2", "versions": "dep1==1.2.3"}
        result = parse_specline(specline, self.default_envs)
        self.assertEqual(
            result["python2.7"], {
                "name": "package",
                "spec": "package==1.2",
                "versions": ["dep1==1.2.3"],
                "overrides": {}
            })
Пример #7
0
    def test_complex_envs(self):
        """Checks if envs overrides what was defined at top level"""
        specline = {
            "name": "name",
            "spec": "package==1.2",
            "versions": ["dep1==1.2.3"],
            "override": {
                "deps_append": ["dep==1.2"]
            },
            "overrides": {
                "depA": {
                    "deps_append": ["dep2==1.2"]
                }
            },
            "envs": {
                "*": {},
                "python2.7": {
                    "name": "new_name",
                    "versions": ["dep2==1.2.3"],
                    "override": {
                        "deps_append": ["dep3==1.2"]
                    },
                }
            }
        }
        result = parse_specline(specline, self.default_envs)

        self.assertEqual(
            result, {
                "python3.3": {
                    "name": "name",
                    "spec": "package==1.2",
                    "versions": ["dep1==1.2.3"],
                    "overrides": {
                        "package": {
                            "deps_append": ["dep==1.2"]
                        },
                        "depA": {
                            "deps_append": ["dep2==1.2"]
                        }
                    }
                },
                "python2.7": {
                    "name": "new_name",
                    "spec": "package==1.2",
                    "versions": ["dep2==1.2.3"],
                    "overrides": {
                        "package": {
                            "deps_append": ["dep3==1.2"]
                        }
                    }
                }
            })
Пример #8
0
    def test_complex_basic(self):
        specline = {"spec": "package==1.2"}
        result = parse_specline(specline, self.default_envs)

        self.assertEqual(result, {
            "python2.7": {
                "name": "package", "spec": "package==1.2",
                "overrides": {}, "versions": []},
            "python3.3": {
                "name": "package", "spec": "package==1.2",
                "overrides": {}, "versions": []}
        })
Пример #9
0
    def test_simple(self):
        specline = "package==1.2"
        result = parse_specline(specline, self.default_envs)

        self.assertEqual(
            result, {
                "python2.7": {
                    "name": "package",
                    "spec": "package==1.2"
                },
                "python3.3": {
                    "name": "package",
                    "spec": "package==1.2"
                }
            })
Пример #10
0
    def test_complex_overides(self):
        """Checks if override gets merged with overrides """
        specline = {
            "spec": "package==1.2",
            "override": {"deps_append": ["dep==1.2"]},
            "overrides": {"depA": {"deps_append": ["dep2==1.2"]}}
        }
        result = parse_specline(specline, self.default_envs)

        self.assertEqual(result["python2.7"], {
            "name": "package",
            "spec": "package==1.2",
            "overrides": {
                "package": {"deps_append": ["dep==1.2"]},
                "depA": {"deps_append": ["dep2==1.2"]}
            },
            "versions": []
        })
Пример #11
0
    def test_complex_basic(self):
        specline = {"spec": "package==1.2"}
        result = parse_specline(specline, self.default_envs)

        self.assertEqual(
            result, {
                "python2.7": {
                    "name": "package",
                    "spec": "package==1.2",
                    "overrides": {},
                    "versions": []
                },
                "python3.3": {
                    "name": "package",
                    "spec": "package==1.2",
                    "overrides": {},
                    "versions": []
                }
            })
Пример #12
0
    def test_complex_envs(self):
        """Checks if envs overrides what was defined at top level"""
        specline = {
            "name": "name",
            "spec": "package==1.2",
            "versions": ["dep1==1.2.3"],
            "override": {"deps_append": ["dep==1.2"]},
            "overrides": {"depA": {"deps_append": ["dep2==1.2"]}},
            "envs": {
                "*": {},
                "python2.7": {
                    "name": "new_name",
                    "versions": ["dep2==1.2.3"],
                    "override": {"deps_append": ["dep3==1.2"]},
                }
            }
        }
        result = parse_specline(specline, self.default_envs)

        self.assertEqual(result, {
            "python3.3": {
                "name": "name",
                "spec": "package==1.2",
                "versions": ["dep1==1.2.3"],
                "overrides": {
                    "package": {"deps_append": ["dep==1.2"]},
                    "depA": {"deps_append": ["dep2==1.2"]}
                }
            },
            "python2.7": {
                "name": "new_name",
                "spec": "package==1.2",
                "versions": ["dep2==1.2.3"],
                "overrides": {"package": {"deps_append": ["dep3==1.2"]}}
            }
        })