← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/fix-bzr-tags-test into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/fix-bzr-tags-test into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/fix-bzr-tags-test/+merge/226618

Fixed up the test to ignore the 2.0.x tags, and updated CI to test when the code is updated, not in the Windows tests
-- 
https://code.launchpad.net/~raoul-snyman/openlp/fix-bzr-tags-test/+merge/226618
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/fix-bzr-tags-test into lp:openlp.
=== modified file 'tests/utils/test_bzr_tags.py'
--- tests/utils/test_bzr_tags.py	2014-06-26 09:21:46 +0000
+++ tests/utils/test_bzr_tags.py	2014-07-13 20:08:02 +0000
@@ -30,7 +30,7 @@
 Package to test for proper bzr tags.
 """
 import os
-
+import re
 from unittest import TestCase
 
 from subprocess import Popen, PIPE
@@ -52,6 +52,10 @@
     ['2.0', '2118'],
     ['2.1.0', '2119']
 ]
+# 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')
 
 
 class TestBzrTags(TestCase):
@@ -65,8 +69,9 @@
 
         # WHEN getting the branches tags
         bzr = Popen(('bzr', 'tags', '--directory=' + path), stdout=PIPE)
-        stdout = bzr.communicate()[0]
-        tags = [line.decode('utf-8').split() for line in stdout.splitlines()]
+        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]))]
 
         # THEN the tags should match the accepted tags
         self.assertEqual(TAGS, tags, 'List of tags should match')


Follow ups