2014-03-13 04:50:45 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# OpenLP - Open Source Lyrics Projection #
|
|
|
|
# --------------------------------------------------------------------------- #
|
2015-01-18 13:39:21 +00:00
|
|
|
# Copyright (c) 2008-2015 OpenLP Developers #
|
2014-03-13 04:50:45 +00:00
|
|
|
# --------------------------------------------------------------------------- #
|
|
|
|
# This program is free software; you can redistribute it and/or modify it #
|
|
|
|
# under the terms of the GNU General Public License as published by the Free #
|
|
|
|
# Software Foundation; version 2 of the License. #
|
|
|
|
# #
|
|
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
|
|
|
# more details. #
|
|
|
|
# #
|
|
|
|
# You should have received a copy of the GNU General Public License along #
|
|
|
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
|
|
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
|
|
|
###############################################################################
|
|
|
|
"""
|
|
|
|
Package to test for proper bzr tags.
|
|
|
|
"""
|
2014-04-14 19:45:41 +00:00
|
|
|
import os
|
2014-07-13 13:10:58 +00:00
|
|
|
import re
|
2014-03-13 04:50:45 +00:00
|
|
|
from unittest import TestCase
|
|
|
|
|
|
|
|
from subprocess import Popen, PIPE
|
|
|
|
|
2014-04-07 02:47:41 +00:00
|
|
|
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'],
|
2014-11-02 17:31:06 +00:00
|
|
|
['2.1.0', '2119'],
|
2015-01-24 19:23:06 +00:00
|
|
|
['2.1.1', '2438'],
|
2015-02-21 20:05:25 +00:00
|
|
|
['2.1.2', '2488'],
|
2015-04-27 21:18:03 +00:00
|
|
|
['2.1.3', '2513'],
|
2015-05-31 13:53:04 +00:00
|
|
|
['2.1.4', '2532'],
|
2015-08-23 19:04:23 +00:00
|
|
|
['2.1.5', '2543'],
|
2015-10-17 11:18:23 +00:00
|
|
|
['2.1.6', '2550'],
|
|
|
|
['2.2', '2562']
|
2014-04-07 02:47:41 +00:00
|
|
|
]
|
2014-07-13 19:21:50 +00:00
|
|
|
# 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.
|
2014-07-13 13:10:58 +00:00
|
|
|
TAG_SEARCH = re.compile('2\.0\.\d')
|
2014-03-13 04:50:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TestBzrTags(TestCase):
|
|
|
|
|
|
|
|
def bzr_tags_test(self):
|
|
|
|
"""
|
|
|
|
Test for proper bzr tags
|
|
|
|
"""
|
|
|
|
# GIVEN: A bzr branch
|
2014-04-14 19:45:41 +00:00
|
|
|
path = os.path.dirname(__file__)
|
2014-03-13 04:50:45 +00:00
|
|
|
|
|
|
|
# WHEN getting the branches tags
|
2014-04-14 19:45:41 +00:00
|
|
|
bzr = Popen(('bzr', 'tags', '--directory=' + path), stdout=PIPE)
|
2014-07-13 13:10:58 +00:00
|
|
|
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]))]
|
2014-03-13 04:50:45 +00:00
|
|
|
|
2014-04-07 02:47:41 +00:00
|
|
|
# THEN the tags should match the accepted tags
|
2014-04-14 20:01:13 +00:00
|
|
|
self.assertEqual(TAGS, tags, 'List of tags should match')
|