def test_update(self): update = { "branch": "some branch", "search": False, "requirements": [ "foo.txt", { "bar.txt": { "pin": True, "compile": { "specs": ["baz.in", "foo.in"] } } } ] } config = Config() self.assertEqual(config.requirements, []) self.assertEqual(config.branch, "master") config.update_config(update) self.assertEqual(config.branch, "some branch") self.assertFalse(config.search) self.assertEqual(config.requirements[0].path, "foo.txt") self.assertEqual(config.requirements[1].path, "bar.txt") self.assertEqual(config.requirements[2].path, "baz.in") self.assertEqual(config.requirements[3].path, "foo.in") self.assertEqual(config.requirements[1].pin, True) self.assertEqual(config.requirements[1].compile.specs, ["baz.in", "foo.in"])
def test_pyup_yml_is_valid(): with open(tools.PYUP_FILE, "r") as i: data = yaml.safe_load(i.read()) config = Config() config.update_config(data) assert config.is_valid_schedule(), "Schedule %r is invalid" % (config.schedule,)
def test_merge_pull_request_with_remove(self): mr = Mock() mr.merge.return_value = True config = Config() config.update_config({'gitlab': {'should_remove_source_branch': True}}) self.provider._merge_merge_request(mr, config) mr.merge.assert_called_once_with(merge_when_pipeline_succeeds=True, remove_source_branch=True)
def test_assignees(self): config = Config() self.assertEqual(config.assignees, []) config.update_config({"assignees": "jay"}) self.assertEqual(config.assignees, ["jay"]) config.update_config({"assignees": ["jay", "bla"]}) self.assertEqual(config.assignees, ["jay", "bla"])
def check_pyup_yml(): with open(tools.PYUP_FILE, 'r') as i: data = yaml.safe_load(i.read()) config = Config() config.update_config(data) if not config.is_valid_schedule(): print('Schedule %r is invalid' % (config.schedule, )) sys.exit(1)
def test_assignees(self): config = Config() self.assertEqual(config.assignees, []) config.update_config({"assignees": "jay"}) self.assertEqual(config.assignees, ["jay"]) config.update_config({"assignees": ["jay", "bla"]}) self.assertEqual(config.assignees, ["jay", "bla"])
def test_pr_prefix(self): config = Config() self.assertEqual(config.pr_prefix, '') config.update_config({"pr_prefix": "Some Prefix"}) self.assertEqual(config.pr_prefix, "Some Prefix") config.pr_prefix = "" config.update_config({"pr_prefix": "Some | Prefix"}) self.assertEqual(config.pr_prefix, "")
def test_pr_prefix(self): config = Config() self.assertEqual(config.pr_prefix, '') config.update_config({"pr_prefix": "Some Prefix"}) self.assertEqual(config.pr_prefix, "Some Prefix") config.pr_prefix = "" config.update_config({"pr_prefix": "Some | Prefix"}) self.assertEqual(config.pr_prefix, "")
def test_gitlab(self): update = { "gitlab": { "should_remove_source_branch": True, "merge_when_pipeline_succeeds": True } } config = Config() self.assertEqual(config.gitlab.should_remove_source_branch, False) self.assertEqual(config.gitlab.merge_when_pipeline_succeeds, False) config.update_config(update) self.assertEqual(config.gitlab.should_remove_source_branch, True) self.assertEqual(config.gitlab.merge_when_pipeline_succeeds, True)
def test_create_pull_request_merge_when_pipeline_succeeds( self, merge_mock): config = Config() self.provider.create_pull_request(self.repo, "title", "body", "master", "new", False, [], config) self.assertEqual(merge_mock.call_count, 0) config.update_config( {'gitlab': { 'merge_when_pipeline_succeeds': True }}) self.provider.create_pull_request(self.repo, "title", "body", "master", "new", False, [], config) self.assertEqual(merge_mock.call_count, 1) merge_mock.assert_called_once_with(ANY, config)
def test_update(self): update = { "branch": "some branch", "search": False, "requirements": [ "foo.txt", {"bar.txt": {"pin": True, "compile": {"specs": ["baz.in", "foo.in"]}}} ] } config = Config() self.assertEqual(config.requirements, []) self.assertEqual(config.branch, "master") config.update_config(update) self.assertEqual(config.branch, "some branch") self.assertFalse(config.search) self.assertEqual(config.requirements[0].path, "foo.txt") self.assertEqual(config.requirements[1].path, "bar.txt") self.assertEqual(config.requirements[2].path, "baz.in") self.assertEqual(config.requirements[3].path, "foo.in") self.assertEqual(config.requirements[1].pin, True) self.assertEqual(config.requirements[1].compile.specs, ["baz.in", "foo.in"])
# consult the git log if you need to determine who owns an individual # contribution. # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # # END HEADER from __future__ import division, print_function, absolute_import import os import sys import yaml from pyup.config import Config from hypothesistooling import ROOT PYUP_FILE = os.path.join(ROOT, '.pyup.yml') if __name__ == '__main__': with open(PYUP_FILE, 'r') as i: data = yaml.safe_load(i.read()) config = Config() config.update_config(data) if not config.is_valid_schedule(): print('Schedule %r is invalid' % (config.schedule,)) sys.exit(1)
# consult the git log if you need to determine who owns an individual # contribution. # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # # END HEADER from __future__ import division, print_function, absolute_import import os import sys import yaml from pyup.config import Config from hypothesistooling import ROOT PYUP_FILE = os.path.join(ROOT, '.pyup.yml') if __name__ == '__main__': with open(PYUP_FILE, 'r') as i: data = yaml.safe_load(i.read()) config = Config() config.update_config(data) if not config.is_valid_schedule(): print('Schedule %r is invalid' % (config.schedule, )) sys.exit(1)