From 61f72875e61383dcecacf4815a8ef181e2c9cecd Mon Sep 17 00:00:00 2001 From: Alec Warner Date: Tue, 6 Mar 2007 07:35:22 +0000 Subject: Update all the unittests to use the new framework, test skipping with isValidAtom, add silly xpak test since I have it 'done' svn path=/main/trunk/; revision=6182 --- pym/portage/tests/dep/test_dep_getcpv.py | 2 +- pym/portage/tests/dep/test_dep_getslot.py | 2 +- pym/portage/tests/dep/test_dep_getusedeps.py | 2 +- pym/portage/tests/dep/test_get_operator.py | 2 +- pym/portage/tests/dep/test_isjustname.py | 2 +- pym/portage/tests/dep/test_isvalidatom.py | 5 +++-- pym/portage/tests/dep/test_match_from_list.py | 2 +- pym/portage/tests/news/test_NewsItem.py | 2 +- pym/portage/tests/util/test_grabdict.py | 2 +- pym/portage/tests/util/test_normalizedPath.py | 2 +- pym/portage/tests/util/test_stackDictList.py | 2 +- pym/portage/tests/util/test_stackDicts.py | 2 +- pym/portage/tests/util/test_stackLists.py | 2 +- pym/portage/tests/util/test_uniqueArray.py | 2 +- pym/portage/tests/util/test_varExpand.py | 2 +- pym/portage/tests/versions/test_vercmp.py | 2 +- pym/portage/tests/xpak/__init__.py | 4 ++++ pym/portage/tests/xpak/test_decodeint.py | 14 ++++++++++++++ 18 files changed, 36 insertions(+), 17 deletions(-) create mode 100644 pym/portage/tests/xpak/__init__.py create mode 100644 pym/portage/tests/xpak/test_decodeint.py diff --git a/pym/portage/tests/dep/test_dep_getcpv.py b/pym/portage/tests/dep/test_dep_getcpv.py index 11fd1a723..a49f4fa6b 100644 --- a/pym/portage/tests/dep/test_dep_getcpv.py +++ b/pym/portage/tests/dep/test_dep_getcpv.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from unittest import TestCase +from portage.tests import TestCase from portage.dep import dep_getcpv class DepGetCPV(TestCase): diff --git a/pym/portage/tests/dep/test_dep_getslot.py b/pym/portage/tests/dep/test_dep_getslot.py index d3b38917a..61ea81586 100644 --- a/pym/portage/tests/dep/test_dep_getslot.py +++ b/pym/portage/tests/dep/test_dep_getslot.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from unittest import TestCase +from portage.tests import TestCase from portage.dep import dep_getslot class DepGetSlot(TestCase): diff --git a/pym/portage/tests/dep/test_dep_getusedeps.py b/pym/portage/tests/dep/test_dep_getusedeps.py index 309c659f5..30fa7772f 100644 --- a/pym/portage/tests/dep/test_dep_getusedeps.py +++ b/pym/portage/tests/dep/test_dep_getusedeps.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id: test_dep_getslot.py 5794 2007-01-27 18:16:08Z antarus $ -from unittest import TestCase +from portage.tests import TestCase from portage.dep import dep_getusedeps import sys diff --git a/pym/portage/tests/dep/test_get_operator.py b/pym/portage/tests/dep/test_get_operator.py index e5b5b7e6c..f93c2776f 100644 --- a/pym/portage/tests/dep/test_get_operator.py +++ b/pym/portage/tests/dep/test_get_operator.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from unittest import TestCase +from portage.tests import TestCase from portage.dep import get_operator class GetOperator(TestCase): diff --git a/pym/portage/tests/dep/test_isjustname.py b/pym/portage/tests/dep/test_isjustname.py index e419e3f26..e6b0e8531 100644 --- a/pym/portage/tests/dep/test_isjustname.py +++ b/pym/portage/tests/dep/test_isjustname.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from unittest import TestCase +from portage.tests import TestCase from portage.dep import isjustname class IsJustName(TestCase): diff --git a/pym/portage/tests/dep/test_isvalidatom.py b/pym/portage/tests/dep/test_isvalidatom.py index 995ec9924..5f0149120 100644 --- a/pym/portage/tests/dep/test_isvalidatom.py +++ b/pym/portage/tests/dep/test_isvalidatom.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from unittest import TestCase +from portage.tests import TestCase from portage.dep import isvalidatom import portage.dep portage.dep._dep_check_strict = True @@ -25,7 +25,7 @@ class IsValidAtom(TestCase): ( "sys-apps/portage:foo", True ), ( "sys-apps/portage-2.1:foo", False ), ( "sys-apps/portage-2.1:", False ), - ( ">~cate-gory/foo-1.0", True ), + ( ">~cate-gory/foo-1.0", False ), ( ">~category/foo-1.0", True ), ( "<~category/foo-1.0", True ), ( "###cat/foo-1.0", False ), @@ -33,6 +33,7 @@ class IsValidAtom(TestCase): ( "portage", False ) ] for test in tests: + raise self.SkipException() if test[1]: atom_type = "valid" else: diff --git a/pym/portage/tests/dep/test_match_from_list.py b/pym/portage/tests/dep/test_match_from_list.py index 4868184a6..8d5b1a812 100644 --- a/pym/portage/tests/dep/test_match_from_list.py +++ b/pym/portage/tests/dep/test_match_from_list.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from unittest import TestCase +from portage.tests import TestCase from portage.dep import match_from_list class AtomCmpEqualGlob(TestCase): diff --git a/pym/portage/tests/news/test_NewsItem.py b/pym/portage/tests/news/test_NewsItem.py index 22ef298d4..6df871728 100644 --- a/pym/portage/tests/news/test_NewsItem.py +++ b/pym/portage/tests/news/test_NewsItem.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id: test_varExpand.py 5596 2007-01-12 08:08:53Z antarus $ -from unittest import TestCase, TestLoader +from portage.tests import TestCase, TestLoader from portage.news import NewsItem from portage.const import PROFILE_PATH diff --git a/pym/portage/tests/util/test_grabdict.py b/pym/portage/tests/util/test_grabdict.py index 9f7b58921..2a0642243 100644 --- a/pym/portage/tests/util/test_grabdict.py +++ b/pym/portage/tests/util/test_grabdict.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from unittest import TestCase, TestLoader +from portage.tests import TestCase from portage.util import grabdict class GrabDictTestCase(TestCase): diff --git a/pym/portage/tests/util/test_normalizedPath.py b/pym/portage/tests/util/test_normalizedPath.py index bd575d266..b6851651a 100644 --- a/pym/portage/tests/util/test_normalizedPath.py +++ b/pym/portage/tests/util/test_normalizedPath.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from unittest import TestCase +from portage.tests import TestCase class NormalizePathTestCase(TestCase): diff --git a/pym/portage/tests/util/test_stackDictList.py b/pym/portage/tests/util/test_stackDictList.py index 9e7a38ba1..ada56fa0f 100644 --- a/pym/portage/tests/util/test_stackDictList.py +++ b/pym/portage/tests/util/test_stackDictList.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from unittest import TestCase +from portage.tests import TestCase class StackDictListTestCase(TestCase): diff --git a/pym/portage/tests/util/test_stackDicts.py b/pym/portage/tests/util/test_stackDicts.py index 9d9637440..aa8a712ef 100644 --- a/pym/portage/tests/util/test_stackDicts.py +++ b/pym/portage/tests/util/test_stackDicts.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from unittest import TestCase +from portage.tests import TestCase from portage.util import stack_dicts diff --git a/pym/portage/tests/util/test_stackLists.py b/pym/portage/tests/util/test_stackLists.py index 3fc028323..c26bbb06a 100644 --- a/pym/portage/tests/util/test_stackLists.py +++ b/pym/portage/tests/util/test_stackLists.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from unittest import TestCase +from portage.tests import TestCase from portage.util import stack_lists class StackListsTestCase(TestCase): diff --git a/pym/portage/tests/util/test_uniqueArray.py b/pym/portage/tests/util/test_uniqueArray.py index 62a315321..e1b9caec8 100644 --- a/pym/portage/tests/util/test_uniqueArray.py +++ b/pym/portage/tests/util/test_uniqueArray.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from unittest import TestCase +from portage.tests import TestCase from portage.util import unique_array class UniqueArrayTestCase(TestCase): diff --git a/pym/portage/tests/util/test_varExpand.py b/pym/portage/tests/util/test_varExpand.py index 47dc7de2c..0a8bf5b11 100644 --- a/pym/portage/tests/util/test_varExpand.py +++ b/pym/portage/tests/util/test_varExpand.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from unittest import TestCase, TestLoader +from portage.tests import TestCase from portage.util import varexpand class VarExpandTestCase(TestCase): diff --git a/pym/portage/tests/versions/test_vercmp.py b/pym/portage/tests/versions/test_vercmp.py index ee3d37741..d43c38e76 100644 --- a/pym/portage/tests/versions/test_vercmp.py +++ b/pym/portage/tests/versions/test_vercmp.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from unittest import TestCase +from portage.tests import TestCase from portage.versions import vercmp class VerCmpTestCase(TestCase): diff --git a/pym/portage/tests/xpak/__init__.py b/pym/portage/tests/xpak/__init__.py new file mode 100644 index 000000000..a3226c133 --- /dev/null +++ b/pym/portage/tests/xpak/__init__.py @@ -0,0 +1,4 @@ +# tests/portage.dep/__init__.py -- Portage Unit Test functionality +# Copyright 2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ diff --git a/pym/portage/tests/xpak/test_decodeint.py b/pym/portage/tests/xpak/test_decodeint.py new file mode 100644 index 000000000..c0f3264db --- /dev/null +++ b/pym/portage/tests/xpak/test_decodeint.py @@ -0,0 +1,14 @@ +# xpak/test_decodeint.py +# Copright Gentoo Foundation 2006 +# Portage Unit Testing Functionality +# $Id$ + +from portage.tests import TestCase +from portage.xpak import decodeint, encodeint + +class testDecodeIntTestCase(TestCase): + + def testDecodeInt(self): + + for n in xrange(1000): + self.assertEqual(decodeint(encodeint(n)), n) -- cgit v1.2.3-1-g7c22