From 2b55c1ceb5c1d473244d52533c515ce9ff471671 Mon Sep 17 00:00:00 2001 From: Jonathan Springer Date: Thu, 13 Mar 2014 17:36:01 -0400 Subject: [PATCH] Change test to use a black list instead of a white list. --- tests/utils/test_bzr_tags.py | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/tests/utils/test_bzr_tags.py b/tests/utils/test_bzr_tags.py index e463aa08b..e9b6b35bc 100644 --- a/tests/utils/test_bzr_tags.py +++ b/tests/utils/test_bzr_tags.py @@ -32,30 +32,9 @@ Package to test for proper bzr tags. from unittest import TestCase -import subprocess - 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.0.1', '?'], - ['2.0.2', '?'], - ['2.0.3', '?'], - ['2.1.0', '2119'] -] +BLACK_LISTED_TAGS = '2.2.2', 'help' class TestBzrTags(TestCase): @@ -70,9 +49,11 @@ class TestBzrTags(TestCase): tags = [] bzr = Popen(('bzr', 'tags'), stdout=PIPE) stdout = bzr.communicate()[0] - lines = (line.decode('utf-8') for line in stdout.splitlines()) + lines = (line.decode('utf-8') for line in stdout.split()) for line in lines: - tags.append(line.split()) + tags.append(line) - # THEN the tags should match the accepted tags - self.assertEqual(TAGS, tags, 'List of tags should match') + # THEN none of the tags should match the black listed tags + for BLACK_LISTED_TAG in BLACK_LISTED_TAGS: + for tag in tags: + self.assertNotEqual(BLACK_LISTED_TAG, tag, 'Tag should not exist')