2014-03-13 04:50:45 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
|
|
|
|
2019-04-13 13:00:22 +00:00
|
|
|
##########################################################################
|
|
|
|
# OpenLP - Open Source Lyrics Projection #
|
|
|
|
# ---------------------------------------------------------------------- #
|
|
|
|
# Copyright (c) 2008-2019 OpenLP Developers #
|
|
|
|
# ---------------------------------------------------------------------- #
|
|
|
|
# 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, either version 3 of the License, or #
|
|
|
|
# (at your option) any later version. #
|
|
|
|
# #
|
|
|
|
# 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, see <https://www.gnu.org/licenses/>. #
|
|
|
|
##########################################################################
|
2014-03-13 04:50:45 +00:00
|
|
|
"""
|
|
|
|
Package to test for proper bzr tags.
|
|
|
|
"""
|
2014-04-14 19:45:41 +00:00
|
|
|
import os
|
2018-10-02 04:39:42 +00:00
|
|
|
from subprocess import PIPE, Popen
|
2019-02-14 21:19:26 +00:00
|
|
|
from unittest import TestCase, SkipTest
|
2014-03-13 04:50:45 +00:00
|
|
|
|
2018-10-02 04:39:42 +00:00
|
|
|
|
2015-10-17 18:11:04 +00:00
|
|
|
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',
|
2015-12-28 20:19:43 +00:00
|
|
|
'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',
|
2016-02-13 14:41:12 +00:00
|
|
|
'2.3.1', '2.3.2', '2.3.3', '2.4'}
|
2014-03-13 04:50:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TestBzrTags(TestCase):
|
|
|
|
|
2016-05-31 21:40:13 +00:00
|
|
|
def test_bzr_tags(self):
|
2014-03-13 04:50:45 +00:00
|
|
|
"""
|
|
|
|
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
|
2019-02-14 21:19:26 +00:00
|
|
|
try:
|
|
|
|
bzr = Popen(('bzr', 'tags', '--directory=' + path), stdout=PIPE)
|
2019-03-07 19:23:04 +00:00
|
|
|
except Exception:
|
2019-02-14 21:19:26 +00:00
|
|
|
raise SkipTest('bzr is not installed')
|
2014-07-13 13:10:58 +00:00
|
|
|
std_out = bzr.communicate()[0]
|
2015-10-17 18:11:04 +00:00
|
|
|
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
|
2014-03-13 04:50:45 +00:00
|
|
|
|
2014-04-07 02:47:41 +00:00
|
|
|
# THEN the tags should match the accepted tags
|
2017-12-23 09:09:45 +00:00
|
|
|
assert count == count1, 'List of tags should match'
|