def test_not_requires_private_env(self): with patch.object(plan, "not_requires_private_env") as not_requires: not_requires.return_value = True dists_for_envs = [plan.SpecForEnv(env=None, spec="test-spec"), plan.SpecForEnv(env=None, spec="test-spec2")] specs_for_prefix = plan.determine_dists_per_prefix( self.res, "some/envs/prefix", self.index, "prefix", dists_for_envs, self.context) expected_output = [plan.SpecsForPrefix( prefix="some/envs/prefix", r=self.res, specs={"test-spec", "test-spec2"})] self.assertEquals(specs_for_prefix, expected_output)
def test_not_requires_private_env(self): with patch.object(plan, "not_requires_private_env") as not_requires: not_requires.return_value = True dists_for_envs = [plan.SpecForEnv(env=None, spec="test-spec"), plan.SpecForEnv(env=None, spec="test-spec2")] specs_for_prefix = plan.determine_dists_per_prefix( self.res, "some/envs/prefix", self.res.index, "prefix", dists_for_envs, self.context) expected_output = [plan.SpecsForPrefix( prefix="some/envs/prefix", r=self.res, specs={"test-spec", "test-spec2"})] self.assertEquals(specs_for_prefix, expected_output)
def test_determine_dists_per_prefix(self, not_requires): with patch.object(plan, "get_resolve_object") as gen_resolve_object_mock: gen_resolve_object_mock.return_value = generate_mocked_resolve(None, self.index) dists_for_envs = [plan.SpecForEnv(env=None, spec="test-spec"), plan.SpecForEnv(env=None, spec="test-spec2"), plan.SpecForEnv(env="ranenv", spec="test")] specs_for_prefix = plan.determine_dists_per_prefix( self.res, "some/prefix", self.index, ["ranenv", None], dists_for_envs, self.context) expected_output = [ plan.SpecsForPrefix(prefix="some/prefix/envs/_ranenv_", r=gen_resolve_object_mock(), specs={"test"}), plan.SpecsForPrefix(prefix="some/prefix", r=self.res, specs=IndexedSet(("test-spec", "test-spec2"))) ] self.assertEquals(expected_output, specs_for_prefix)
def test_determine_dists_per_prefix(self, not_requires): with patch.object(plan, "get_resolve_object") as gen_resolve_object_mock: gen_resolve_object_mock.return_value = self.res dists_for_envs = [plan.SpecForEnv(env=None, spec="test-spec"), plan.SpecForEnv(env=None, spec="test-spec2"), plan.SpecForEnv(env="ranenv", spec="test")] specs_for_prefix = plan.determine_dists_per_prefix( self.res, "some/prefix", self.res.index, ["ranenv", None], dists_for_envs, self.context) expected_output = [ plan.SpecsForPrefix(prefix="some/prefix/envs/_ranenv_", r=gen_resolve_object_mock(), specs={"test"}), plan.SpecsForPrefix(prefix="some/prefix", r=self.res, specs=IndexedSet(("test-spec", "test-spec2"))) ] self.assertEquals(expected_output, specs_for_prefix)