Fix bzt tag test to handle being run from a different directory

This commit is contained in:
Jonathan Springer 2014-04-14 15:45:41 -04:00
parent b00e5bc5f0
commit 97ecc3442f
1 changed files with 4 additions and 2 deletions

View File

@ -29,6 +29,7 @@
""" """
Package to test for proper bzr tags. Package to test for proper bzr tags.
""" """
import os
from unittest import TestCase from unittest import TestCase
@ -63,11 +64,12 @@ class TestBzrTags(TestCase):
Test for proper bzr tags Test for proper bzr tags
""" """
# GIVEN: A bzr branch # GIVEN: A bzr branch
path = os.path.dirname(__file__)
# WHEN getting the branches tags # WHEN getting the branches tags
bzr = Popen(('bzr', 'tags'), stdout=PIPE) bzr = Popen(('bzr', 'tags', '--directory=' + path), stdout=PIPE)
stdout = bzr.communicate()[0] stdout = bzr.communicate()[0]
tags = [line.decode('utf-8').split() for line in stdout.splitlines()] tags = [line.decode('utf-8').split() for line in stdout.splitlines()]
# THEN the tags should match the accepted tags # THEN the tags should match the accepted tags
self.assertEqual(TAGS, tags, 'List of tags should match') self.assertEqual(TAGS, tags, path)