MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / test_push_and_errors

Method test_push_and_errors

scripts/ci-scope_test.py:51–68  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

49 self.assertEqual(scope.has_local_dependencies(go_mod, package), want)
50
51 def test_push_and_errors(self):
52 self.assertTrue(all(scope.for_event('push', {}).values()))
53 for event, payload in [('schedule', {}), ('pull_request', {}),
54 ('pull_request', {'pull_request': {'base': {'sha': 'bad'}, 'head': {'sha': 'bad'}}})]:
55 with self.subTest(event=event, payload=payload), self.assertRaises(ValueError):
56 scope.for_event(event, payload)
57 for data in [b'file', b'\0', b'../outside\0', b'/absolute\0', b'a\0\0']:
58 with self.subTest(data=data), self.assertRaises(ValueError):
59 scope.decode_paths(data)
60 self.assertEqual(scope.decode_paths(b''), [])
61 for returns in (
62 [subprocess.CalledProcessError(1, 'cat-file')],
63 [b'', b'', subprocess.CalledProcessError(1, 'merge-base')],
64 [b'', b'', b'not-a-sha\n'],
65 [b'', b'', b'a'*40+b'\n', subprocess.CalledProcessError(1, 'diff')]):
66 with self.subTest(returns=returns), patch.object(scope, 'git', side_effect=returns):
67 with self.assertRaises((subprocess.CalledProcessError, ValueError)):
68 scope.pr_paths('a'*40, 'b'*40)
69
70 def test_merge_base_deletions_and_rename(self):
71 with tempfile.TemporaryDirectory() as tmp:

Callers

nothing calls this directly

Calls 1

allFunction · 0.85

Tested by

no test coverage detected