summaryrefslogtreecommitdiffstats
path: root/tests/portage_dep
diff options
context:
space:
mode:
authorAlec Warner <antarus@gentoo.org>2007-01-27 18:16:08 +0000
committerAlec Warner <antarus@gentoo.org>2007-01-27 18:16:08 +0000
commit6ac1f119472d2e41650f4cf7a9bdb17a3afda42c (patch)
treed993452f7ea513226b6fa4f6fd1ce130796a2914 /tests/portage_dep
parent8a4a1ddb2255979e94ba5dd0148c4bbfd4920e57 (diff)
downloadportage-6ac1f119472d2e41650f4cf7a9bdb17a3afda42c.tar.gz
portage-6ac1f119472d2e41650f4cf7a9bdb17a3afda42c.tar.bz2
portage-6ac1f119472d2e41650f4cf7a9bdb17a3afda42c.zip
Move tests into new directory structure
svn path=/main/trunk/; revision=5794
Diffstat (limited to 'tests/portage_dep')
-rw-r--r--tests/portage_dep/__init__.py4
-rw-r--r--tests/portage_dep/test_dep_getcpv.py31
-rw-r--r--tests/portage_dep/test_dep_getslot.py27
-rw-r--r--tests/portage_dep/test_get_operator.py26
-rw-r--r--tests/portage_dep/test_isjustname.py25
-rw-r--r--tests/portage_dep/test_isvalidatom.py36
-rw-r--r--tests/portage_dep/test_match_from_list.py31
7 files changed, 0 insertions, 180 deletions
diff --git a/tests/portage_dep/__init__.py b/tests/portage_dep/__init__.py
deleted file mode 100644
index a3226c133..000000000
--- a/tests/portage_dep/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# 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/tests/portage_dep/test_dep_getcpv.py b/tests/portage_dep/test_dep_getcpv.py
deleted file mode 100644
index 857a408a3..000000000
--- a/tests/portage_dep/test_dep_getcpv.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# test_dep_getcpv.py -- Portage Unit Testing Functionality
-# Copyright 2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-from unittest import TestCase
-from portage.dep import dep_getcpv
-
-class DepGetCPV(TestCase):
- """ A simple testcase for isvalidatom
- """
-
- def testDepGetCPV(self):
-
- prefix_ops = ["<", ">", "=", "~", "!", "<=",
- ">=", "!=", "!<", "!>", "!~",""]
-
- bad_prefix_ops = [ ">~", "<~", "~>", "~<" ]
- postfix_ops = [ "*", "" ]
-
- cpvs = ["sys-apps/portage"]
-
- for cpv in cpvs:
- for prefix in prefix_ops:
- for postfix in postfix_ops:
- self.assertEqual( dep_getcpv(
- prefix + cpv + postfix ), cpv )
- for prefix in bad_prefix_ops:
- for postfix in postfix_ops:
- self.assertNotEqual( dep_getcpv(
- prefix + cpv + postfix ), cpv )
diff --git a/tests/portage_dep/test_dep_getslot.py b/tests/portage_dep/test_dep_getslot.py
deleted file mode 100644
index 7c3004d05..000000000
--- a/tests/portage_dep/test_dep_getslot.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# test_dep_getslot.py -- Portage Unit Testing Functionality
-# Copyright 2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-from unittest import TestCase
-from portage.dep import dep_getslot
-
-class DepGetSlot(TestCase):
- """ A simple testcase for isvalidatom
- """
-
- def testDepGetSlot(self):
-
- slot_char = ":"
- slots = ( "a", "1.2", "1", "IloveVapier", None )
- cpvs = ["sys-apps/portage"]
-
- for cpv in cpvs:
- for slot in slots:
- if slot:
- self.assertEqual( dep_getslot(
- cpv + slot_char + slot ), slot )
- else:
- self.assertEqual( dep_getslot( cpv ), slot )
-
- self.assertEqual( dep_getslot( "sys-apps/portage:"), "" )
diff --git a/tests/portage_dep/test_get_operator.py b/tests/portage_dep/test_get_operator.py
deleted file mode 100644
index 28485e0f0..000000000
--- a/tests/portage_dep/test_get_operator.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# test_match_from_list.py -- Portage Unit Testing Functionality
-# Copyright 2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-from unittest import TestCase
-from portage.dep import get_operator
-
-class GetOperator(TestCase):
-
- def testGetOperator(self):
-
- # get_operator does not validate operators
- tests = [ ( "~", "~" ), ( "=", "=" ), ( ">", ">" ),
- ( ">=", ">=" ), ( "<=", "<=" ) , ( "", None ),
- ( ">~", ">" ), ("~<", "~"), ( "=~", "=" ),
- ( "=>", "=" ), ("=<", "=") ]
-
- testCP = "sys-apps/portage"
-
- for test in tests:
- result = get_operator( test[0] + testCP )
- self.assertEqual( result, test[1] )
-
- result = get_operator( "=sys-apps/portage*" )
- self.assertEqual( result , "=*" )
diff --git a/tests/portage_dep/test_isjustname.py b/tests/portage_dep/test_isjustname.py
deleted file mode 100644
index e419e3f26..000000000
--- a/tests/portage_dep/test_isjustname.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# test_isjustname.py -- Portage Unit Testing Functionality
-# Copyright 2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-from unittest import TestCase
-from portage.dep import isjustname
-
-class IsJustName(TestCase):
-
- def testIsJustName(self):
-
- cats = ( "", "sys-apps/", "foo/", "virtual/" )
- pkgs = ( "portage", "paludis", "pkgcore", "notARealPkg" )
- vers = ( "", "-2.0-r3", "-1.0_pre2", "-3.1b" )
-
- for pkg in pkgs:
- for cat in cats:
- for ver in vers:
- if len(ver):
- self.assertFalse( isjustname( cat + pkg + ver ),
- msg="isjustname(%s) is True!" % (cat + pkg + ver) )
- else:
- self.assertTrue( isjustname( cat + pkg + ver ),
- msg="isjustname(%s) is False!" % (cat + pkg + ver) )
diff --git a/tests/portage_dep/test_isvalidatom.py b/tests/portage_dep/test_isvalidatom.py
deleted file mode 100644
index d373a52f0..000000000
--- a/tests/portage_dep/test_isvalidatom.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# test_isvalidatom.py -- Portage Unit Testing Functionality
-# Copyright 2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-from unittest import TestCase
-from portage.dep import isvalidatom
-
-class IsValidAtom(TestCase):
- """ A simple testcase for isvalidatom
- """
-
- def testIsValidAtom(self):
-
- tests = [ ( "sys-apps/portage", True ),
- ( "=sys-apps/portage-2.1", True ),
- ( "=sys-apps/portage-2.1*", True ),
- ( ">=sys-apps/portage-2.1", True ),
- ( "<=sys-apps/portage-2.1", True ),
- ( ">sys-apps/portage-2.1", True ),
- ( "<sys-apps/portage-2.1", True ),
- ( "~sys-apps/portage-2.1", True ),
- ( ">~cate-gory/foo-1.0", False ),
- ( ">~category/foo-1.0", False ),
- ( "<~category/foo-1.0", False ),
- ( "###cat/foo-1.0", False ),
- ( "~sys-apps/portage", False ),
- ( "portage", False ) ]
-
- for test in tests:
- if test[1]:
- atom_type = "valid"
- else:
- atom_type = "invalid"
- self.assertEqual( bool(isvalidatom( test[0] )), test[1],
- msg="isvalidatom(%s) != %s" % ( test[0], test[1] ) )
diff --git a/tests/portage_dep/test_match_from_list.py b/tests/portage_dep/test_match_from_list.py
deleted file mode 100644
index 4868184a6..000000000
--- a/tests/portage_dep/test_match_from_list.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# test_match_from_list.py -- Portage Unit Testing Functionality
-# Copyright 2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-from unittest import TestCase
-from portage.dep import match_from_list
-
-class AtomCmpEqualGlob(TestCase):
- """ A simple testcase for =* glob matching
- """
-
- def testEqualGlobPass(self):
- tests = [ ("=sys-apps/portage-45*", "sys-apps/portage-045" ),
- ("=sys-fs/udev-1*", "sys-fs/udev-123"),
- ("=sys-fs/udev-4*", "sys-fs/udev-456" ) ]
-
-# I need to look up the cvs syntax
-# ("=sys-fs/udev_cvs*","sys-fs/udev_cvs_pre4" ) ]
-
- for test in tests:
- self.assertEqual( len(match_from_list( test[0], [test[1]] )), 1 )
-
- def testEqualGlobFail(self):
- tests = [ ("=sys-apps/portage-2*", "sys-apps/portage-2.1" ),
- ("=sys-apps/portage-2.1*", "sys-apps/portage-2.1.2" ) ]
- for test in tests:
- try:
- self.assertEqual( len( match_from_list( test[0], [test[1]] ) ), 1 )
- except TypeError: # failure is ok here
- pass