29
29
class ProjectTestCase(test.TestCase):
30
30
def test_authors_up_to_date(self):
31
31
topdir = os.path.normpath(os.path.dirname(__file__) + '/../../')
34
mailmap = parse_mailmap(os.path.join(topdir, '.mailmap'))
35
authors_file = open(os.path.join(topdir, 'Authors'), 'r').read()
32
37
if os.path.exists(os.path.join(topdir, '.bzr')):
35
mailmap = parse_mailmap(os.path.join(topdir, '.mailmap'))
37
38
import bzrlib.workingtree
38
39
tree = bzrlib.workingtree.WorkingTree.open(topdir)
48
49
for author in r.get_apparent_authors():
49
50
email = author.split(' ')[-1]
50
contributors.add(str_dict_replace(email, mailmap))
52
authors_file = open(os.path.join(topdir, 'Authors'),
56
for contributor in contributors:
57
if contributor == 'nova-core':
59
if not contributor in authors_file:
60
missing.add(contributor)
62
self.assertTrue(len(missing) == 0,
63
'%r not listed in Authors' % missing)
51
contributors.add(str_dict_replace(email,
56
elif os.path.exists(os.path.join(topdir, '.git')):
58
repo = git.Repo(topdir)
59
for commit in repo.head.commit.iter_parents():
60
email = commit.author.email
62
email = commit.author.name
63
if 'nova-core' in email:
65
if email.split(' ')[-1] == '<>':
66
email = email.split(' ')[-2]
67
email = '<' + email + '>'
68
contributors.add(str_dict_replace(email, mailmap))
71
self.assertTrue(False, 'Cannot read commit history')
73
for contributor in contributors:
74
if contributor == 'nova-core':
76
if not contributor in authors_file:
77
missing.add(contributor)
79
self.assertTrue(len(missing) == 0,
80
'%r not listed in Authors' % missing)
68
83
class LockTestCase(test.TestCase):
69
84
def test_synchronized_wrapped_function_metadata(self):