forked from openlp/openlp
Refactor tests
This commit is contained in:
parent
cee4a138ac
commit
c61fde2d1f
@ -23,39 +23,13 @@
|
||||
Package to test for proper bzr tags.
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
from unittest import TestCase
|
||||
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
TAGS = [
|
||||
['1.9.0', '1'],
|
||||
['1.9.1', '775'],
|
||||
['1.9.2', '890'],
|
||||
['1.9.3', '1063'],
|
||||
['1.9.4', '1196'],
|
||||
['1.9.5', '1421'],
|
||||
['1.9.6', '1657'],
|
||||
['1.9.7', '1761'],
|
||||
['1.9.8', '1856'],
|
||||
['1.9.9', '1917'],
|
||||
['1.9.10', '2003'],
|
||||
['1.9.11', '2039'],
|
||||
['1.9.12', '2063'],
|
||||
['2.0', '2118'],
|
||||
['2.1.0', '2119'],
|
||||
['2.1.1', '2438'],
|
||||
['2.1.2', '2488'],
|
||||
['2.1.3', '2513'],
|
||||
['2.1.4', '2532'],
|
||||
['2.1.5', '2543'],
|
||||
['2.1.6', '2550'],
|
||||
['2.2', '2562']
|
||||
]
|
||||
# Depending on the repository, we sometimes have the 2.0.x tags in the repo too. They come up with a revision number of
|
||||
# "?", which I suspect is due to the fact that we're using shared repositories. This regular expression matches all
|
||||
# 2.0.x tags.
|
||||
TAG_SEARCH = re.compile('2\.0\.\d')
|
||||
TAGS1 = {'1.9.0', '1.9.1', '1.9.2', '1.9.3', '1.9.4', '1.9.5', '1.9.6', '1.9.7', '1.9.8', '1.9.9', '1.9.10',
|
||||
'1.9.11', '1.9.12', '2.0', '2.1.0', '2.1.1', '2.1.2', '2.1.3', '2.1.4', '2.1.5', '2.1.6', '2.2'
|
||||
}
|
||||
|
||||
|
||||
class TestBzrTags(TestCase):
|
||||
@ -70,8 +44,12 @@ class TestBzrTags(TestCase):
|
||||
# WHEN getting the branches tags
|
||||
bzr = Popen(('bzr', 'tags', '--directory=' + path), stdout=PIPE)
|
||||
std_out = bzr.communicate()[0]
|
||||
tags = [line.decode('utf-8').split() for line in std_out.splitlines()]
|
||||
tags = [t_r for t_r in tags if t_r[1] != '?' or not (t_r[1] == '?' and TAG_SEARCH.search(t_r[0]))]
|
||||
count = len(TAGS1)
|
||||
tags = [line.decode('utf-8').split()[0] for line in std_out.splitlines()]
|
||||
count1 = 0
|
||||
for t in tags:
|
||||
if t in TAGS1:
|
||||
count1 += 1
|
||||
|
||||
# THEN the tags should match the accepted tags
|
||||
self.assertEqual(TAGS, tags, 'List of tags should match')
|
||||
self.assertEqual(count, count1, 'List of tags should match')
|
||||
|
Loading…
Reference in New Issue
Block a user