public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2011-07-15  9:52 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2011-07-15  9:52 UTC (permalink / raw
  To: gentoo-commits

commit:     96d43547ff234a34aa2c8dff8c981662d5cd5e5d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 15 08:50:26 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 08:50:26 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=96d43547

Tests: keep real package names in separate module.

---
 gentoopm/tests/__init__.py |   15 +++++++++++++++
 gentoopm/tests/atom.py     |    9 ++++-----
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/gentoopm/tests/__init__.py b/gentoopm/tests/__init__.py
index 40f0b75..f430917 100644
--- a/gentoopm/tests/__init__.py
+++ b/gentoopm/tests/__init__.py
@@ -36,3 +36,18 @@ class PMTestLoader(unittest.TestLoader):
 		if isinstance(mod, basestring):
 			mod = __import__(mod, fromlist=['.'], level=-1)
 		return unittest.TestLoader.loadTestsFromModule(self, mod)
+
+class PackageNames(object):
+	"""
+	A container for package names used in tests. Supposed to allow simple
+	switch to another packages when one of them stops to work.
+	"""
+
+	single = 'portage'
+	""" Incomplete atom matching a single package. """
+
+	single_complete = 'sys-apps/portage'
+	""" Complete atom matching a single package. """
+
+	multiple = 'pms'
+	""" Incomplete atom matching multiple packages. """

diff --git a/gentoopm/tests/atom.py b/gentoopm/tests/atom.py
index bee882d..53e7045 100644
--- a/gentoopm/tests/atom.py
+++ b/gentoopm/tests/atom.py
@@ -4,12 +4,12 @@
 # Released under the terms of the 2-clause BSD license.
 
 from gentoopm.exceptions import InvalidAtomStringError, AmbiguousPackageSetError
-from gentoopm.tests import PMTestCase
+from gentoopm.tests import PMTestCase, PackageNames
 
 class UserSpecifiedAtomTestCase(PMTestCase):
 	def setUp(self):
-		self._incomplete_atom = self.pm.Atom('portage')
-		self._complete_atom = self.pm.Atom('sys-apps/portage')
+		self._incomplete_atom = self.pm.Atom(PackageNames.single)
+		self._complete_atom = self.pm.Atom(PackageNames.single_complete)
 		self._associated_atom = self._complete_atom.get_associated(self.pm.stack)
 
 	def test_invalid_atoms(self):
@@ -42,8 +42,7 @@ class UserSpecifiedAtomTestCase(PMTestCase):
 		self.assertEqual(a.associated, True)
 
 	def test_ambiguous_atom_association(self):
-		# XXX: risky
-		ia = self.pm.Atom('pms')
+		ia = self.pm.Atom(PackageNames.multiple)
 		self.assertRaises(AmbiguousPackageSetError, ia.get_associated,
 				self.pm.stack)
 



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2011-07-15  9:52 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2011-07-15  9:52 UTC (permalink / raw
  To: gentoo-commits

commit:     41d06c671592a5784ce7477c35a58ec81349836c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 15 08:57:03 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 08:57:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=41d06c67

Tests: use assertTrue/assertFalse.

---
 gentoopm/tests/atom.py |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gentoopm/tests/atom.py b/gentoopm/tests/atom.py
index 53e7045..21ab993 100644
--- a/gentoopm/tests/atom.py
+++ b/gentoopm/tests/atom.py
@@ -18,13 +18,13 @@ class UserSpecifiedAtomTestCase(PMTestCase):
 
 	def test_incomplete_atom(self):
 		a = self._incomplete_atom
-		self.assertEqual(a.complete, False)
-		self.assertEqual(a.associated, False)
+		self.assertFalse(a.complete)
+		self.assertFalse(a.associated)
 
 	def test_complete_atom(self):
 		a = self._complete_atom
-		self.assertEqual(a.complete, True)
-		self.assertEqual(a.associated, False)
+		self.assertTrue(a.complete)
+		self.assertFalse(a.associated)
 
 	def test_atom_stringification(self):
 		for atstr in ('foo/bar', '>=baz/bar-100', 'foo/baz:10',
@@ -33,13 +33,13 @@ class UserSpecifiedAtomTestCase(PMTestCase):
 
 	def test_atom_association(self):
 		a = self._associated_atom
-		self.assertEqual(a.complete, True)
-		self.assertEqual(a.associated, True)
+		self.assertTrue(a.complete)
+		self.assertTrue(a.associated)
 
 	def test_incomplete_atom_association(self):
 		a = self._incomplete_atom.get_associated(self.pm.stack)
-		self.assertEqual(a.complete, True)
-		self.assertEqual(a.associated, True)
+		self.assertTrue(a.complete)
+		self.assertTrue(a.associated)
 
 	def test_ambiguous_atom_association(self):
 		ia = self.pm.Atom(PackageNames.multiple)



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2011-07-15  9:52 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2011-07-15  9:52 UTC (permalink / raw
  To: gentoo-commits

commit:     7aaaec776f6d8b73f7b71c306c852a66a6de0aef
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 15 09:51:14 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 09:51:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=7aaaec77

Change the test package to something in @system.

---
 gentoopm/tests/__init__.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gentoopm/tests/__init__.py b/gentoopm/tests/__init__.py
index 7b52fae..d4b2a75 100644
--- a/gentoopm/tests/__init__.py
+++ b/gentoopm/tests/__init__.py
@@ -43,10 +43,10 @@ class PackageNames(object):
 	switch to another packages when one of them stops to work.
 	"""
 
-	single = 'portage'
+	single = 'coreutils'
 	""" Incomplete atom matching a single package. """
 
-	single_complete = 'sys-apps/portage'
+	single_complete = 'sys-apps/coreutils'
 	""" Complete atom matching a single package. """
 
 	multiple = 'pms'



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2011-07-15 12:34 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2011-07-15 12:34 UTC (permalink / raw
  To: gentoo-commits

commit:     c331753e7d32c1329a53291d9d8c79dc14f2156a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 15 12:09:53 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 12:09:53 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=c331753e

Return PM name in test failure message.

---
 gentoopm/tests/__init__.py |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/gentoopm/tests/__init__.py b/gentoopm/tests/__init__.py
index e96860f..88ad284 100644
--- a/gentoopm/tests/__init__.py
+++ b/gentoopm/tests/__init__.py
@@ -18,6 +18,36 @@ class PMTestCase(unittest.TestCase):
 		assert(self._pm is None)
 		self._pm = val
 
+	def assertEqual(self, *args):
+		try:
+			unittest.TestCase.assertEqual(self, *args)
+		except AssertionError as e:
+			raise AssertionError('[%s] %s' % (self._pm.name, e.message))
+
+	def assertNotEqual(self, *args):
+		try:
+			unittest.TestCase.assertNotEqual(self, *args)
+		except AssertionError as e:
+			raise AssertionError('[%s] %s' % (self._pm.name, e.message))
+
+	def assertTrue(self, *args):
+		try:
+			unittest.TestCase.assertTrue(self, *args)
+		except AssertionError as e:
+			raise AssertionError('[%s] %s' % (self._pm.name, e.message))
+
+	def assertFalse(self, *args):
+		try:
+			unittest.TestCase.assertFalse(self, *args)
+		except AssertionError as e:
+			raise AssertionError('[%s] %s' % (self._pm.name, e.message))
+
+	def assertRaises(self, *args):
+		try:
+			unittest.TestCase.assertRaises(self, *args)
+		except AssertionError as e:
+			raise AssertionError('[%s] %s' % (self._pm.name, e.message))
+
 class PMTestSuiteFactory(object):
 	def __init__(self, pm):
 		self._pm = pm



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2011-07-15 13:32 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2011-07-15 13:32 UTC (permalink / raw
  To: gentoo-commits

commit:     bb44bd565682dc4ac88fc745fb1db2b53e0e7dd1
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 15 12:58:22 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 12:58:22 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=bb44bd56

Py3: fix instantiating tests.

---
 gentoopm/tests/__init__.py |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/gentoopm/tests/__init__.py b/gentoopm/tests/__init__.py
index 88ad284..e6a9fe6 100644
--- a/gentoopm/tests/__init__.py
+++ b/gentoopm/tests/__init__.py
@@ -53,6 +53,7 @@ class PMTestSuiteFactory(object):
 		self._pm = pm
 
 	def __call__(self, tests):
+		tests = list(tests)
 		for t in tests:
 			t.pm = self._pm
 		return unittest.TestSuite(tests)



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2011-07-15 13:32 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2011-07-15 13:32 UTC (permalink / raw
  To: gentoo-commits

commit:     b27ca3d69694509ceb8881cf956f1bd4ddf21428
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 15 12:59:49 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 12:59:49 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=b27ca3d6

Py3: Fix re-raising AssertionErrors.

---
 gentoopm/tests/__init__.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gentoopm/tests/__init__.py b/gentoopm/tests/__init__.py
index e6a9fe6..08f50b7 100644
--- a/gentoopm/tests/__init__.py
+++ b/gentoopm/tests/__init__.py
@@ -22,31 +22,31 @@ class PMTestCase(unittest.TestCase):
 		try:
 			unittest.TestCase.assertEqual(self, *args)
 		except AssertionError as e:
-			raise AssertionError('[%s] %s' % (self._pm.name, e.message))
+			raise AssertionError('[%s] %s' % (self._pm.name, e.args[0]))
 
 	def assertNotEqual(self, *args):
 		try:
 			unittest.TestCase.assertNotEqual(self, *args)
 		except AssertionError as e:
-			raise AssertionError('[%s] %s' % (self._pm.name, e.message))
+			raise AssertionError('[%s] %s' % (self._pm.name, e.args[0]))
 
 	def assertTrue(self, *args):
 		try:
 			unittest.TestCase.assertTrue(self, *args)
 		except AssertionError as e:
-			raise AssertionError('[%s] %s' % (self._pm.name, e.message))
+			raise AssertionError('[%s] %s' % (self._pm.name, e.args[0]))
 
 	def assertFalse(self, *args):
 		try:
 			unittest.TestCase.assertFalse(self, *args)
 		except AssertionError as e:
-			raise AssertionError('[%s] %s' % (self._pm.name, e.message))
+			raise AssertionError('[%s] %s' % (self._pm.name, e.args[0]))
 
 	def assertRaises(self, *args):
 		try:
 			unittest.TestCase.assertRaises(self, *args)
 		except AssertionError as e:
-			raise AssertionError('[%s] %s' % (self._pm.name, e.message))
+			raise AssertionError('[%s] %s' % (self._pm.name, e.args[0]))
 
 class PMTestSuiteFactory(object):
 	def __init__(self, pm):



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2011-07-17 22:19 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2011-07-17 22:19 UTC (permalink / raw
  To: gentoo-commits

commit:     8b6411841c540f7e7b40ca7465cfe12949a50b28
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 17 22:19:43 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 17 22:20:08 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=8b641184

Tests: don't expect having multi-matching atom installed.

---
 gentoopm/tests/psets.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gentoopm/tests/psets.py b/gentoopm/tests/psets.py
index 35484ef..42b453a 100644
--- a/gentoopm/tests/psets.py
+++ b/gentoopm/tests/psets.py
@@ -41,7 +41,7 @@ class PackageSetsTestCase(PMTestCase):
 	def test_filter_atom_multiple(self):
 		""" Check whether multi-matching atoms return multiple packages. """
 		at = PackageNames.multiple
-		for r in self._repos:
+		for r in (self._repo, self._stack):
 			keys = set()
 			for p in r.filter(at):
 				keys.add(p.key)
@@ -64,7 +64,7 @@ class PackageSetsTestCase(PMTestCase):
 
 	def test_select_atom_multiple(self):
 		at = PackageNames.multiple
-		for r in self._repos:
+		for r in (self._repo, self._stack):
 			self.assertRaises(AmbiguousPackageSetError, r.select, at)
 
 	def test_select_atom_empty(self):
@@ -104,7 +104,7 @@ class PackageSetsTestCase(PMTestCase):
 
 	def test_contains_atom_multiple(self):
 		at = PackageNames.multiple
-		for r in self._repos:
+		for r in (self._repo, self._stack):
 			self.assertTrue(at in r)
 
 	def test_contains_atom_empty(self):



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2011-07-19  9:56 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2011-07-19  9:56 UTC (permalink / raw
  To: gentoo-commits

commit:     83015161092c221d4440cba8a6aec5c325581011
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 19 09:26:42 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jul 19 09:26:42 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=83015161

Commonize assert wrapping code.

---
 gentoopm/tests/__init__.py |   27 +++++++++------------------
 1 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/gentoopm/tests/__init__.py b/gentoopm/tests/__init__.py
index 08f50b7..fbb773f 100644
--- a/gentoopm/tests/__init__.py
+++ b/gentoopm/tests/__init__.py
@@ -18,35 +18,26 @@ class PMTestCase(unittest.TestCase):
 		assert(self._pm is None)
 		self._pm = val
 
-	def assertEqual(self, *args):
+	def _try(self, f, args):
 		try:
-			unittest.TestCase.assertEqual(self, *args)
+			f(self, *args)
 		except AssertionError as e:
 			raise AssertionError('[%s] %s' % (self._pm.name, e.args[0]))
 
+	def assertEqual(self, *args):
+		self._try(unittest.TestCase.assertEqual, args)
+
 	def assertNotEqual(self, *args):
-		try:
-			unittest.TestCase.assertNotEqual(self, *args)
-		except AssertionError as e:
-			raise AssertionError('[%s] %s' % (self._pm.name, e.args[0]))
+		self._try(unittest.TestCase.assertNotEqual, args)
 
 	def assertTrue(self, *args):
-		try:
-			unittest.TestCase.assertTrue(self, *args)
-		except AssertionError as e:
-			raise AssertionError('[%s] %s' % (self._pm.name, e.args[0]))
+		self._try(unittest.TestCase.assertTrue, args)
 
 	def assertFalse(self, *args):
-		try:
-			unittest.TestCase.assertFalse(self, *args)
-		except AssertionError as e:
-			raise AssertionError('[%s] %s' % (self._pm.name, e.args[0]))
+		self._try(unittest.TestCase.assertFalse, args)
 
 	def assertRaises(self, *args):
-		try:
-			unittest.TestCase.assertRaises(self, *args)
-		except AssertionError as e:
-			raise AssertionError('[%s] %s' % (self._pm.name, e.args[0]))
+		self._try(unittest.TestCase.assertRaises, args)
 
 class PMTestSuiteFactory(object):
 	def __init__(self, pm):



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2011-07-19  9:56 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2011-07-19  9:56 UTC (permalink / raw
  To: gentoo-commits

commit:     ff335f908bfe971ee8961580e6933950c2ac3ef0
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 19 09:30:37 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jul 19 09:30:37 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=ff335f90

Tests: prepend all exceptions with PM name.

---
 gentoopm/tests/__init__.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gentoopm/tests/__init__.py b/gentoopm/tests/__init__.py
index fbb773f..807af17 100644
--- a/gentoopm/tests/__init__.py
+++ b/gentoopm/tests/__init__.py
@@ -21,8 +21,12 @@ class PMTestCase(unittest.TestCase):
 	def _try(self, f, args):
 		try:
 			f(self, *args)
-		except AssertionError as e:
-			raise AssertionError('[%s] %s' % (self._pm.name, e.args[0]))
+		except Exception as e:
+			if isinstance(e.args[0], str):
+				raise e.__class__('[%s] %s' % (self._pm.name, e.args[0]),
+						*e.args[1:])
+			else:
+				raise
 
 	def assertEqual(self, *args):
 		self._try(unittest.TestCase.assertEqual, args)



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2011-07-20  9:41 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2011-07-20  9:41 UTC (permalink / raw
  To: gentoo-commits

commit:     125f9f94d375d477bca093145099353f195518e9
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 20 09:41:47 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jul 20 09:41:47 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=125f9f94

Add tests for new PMPackage properties.

---
 gentoopm/tests/pkg.py |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/gentoopm/tests/pkg.py b/gentoopm/tests/pkg.py
index 431a321..b43fbc0 100644
--- a/gentoopm/tests/pkg.py
+++ b/gentoopm/tests/pkg.py
@@ -63,6 +63,22 @@ class PackagesTestCase(PMTestCase):
 			self.assertRaises(KeyError, lambda m, rk: m[rk], p.metadata, rk)
 			self.assertRaises(AttributeError, getattr, p.metadata, rk)
 
+	def test_description(self):
+		""" Check whether description works as expected. """
+		for p in self._pkgs:
+			self.assertEqual(str(p.description),
+					p.description.long if p.description.long is not None
+					else p.description.short)
+
+	def test_inherits(self):
+		""" Check whether inherits are an iterable of stringifiables. """
+		for p in self._pkgs:
+			if p.inherits is not None:
+				try:
+					self.assertTrue(str(next(iter(p.inherits))))
+				except StopIteration:
+					pass
+
 	def test_environ_dict(self):
 		""" Try to access environment.bz2 via dict. """
 		rk = PackageNames.envsafe_metadata_key



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2011-07-25 17:06 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2011-07-25 17:06 UTC (permalink / raw
  To: gentoo-commits

commit:     289843c0f4285476a820cfa3aac68fcb425228fc
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 25 17:06:30 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jul 25 17:06:58 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=289843c0

Add tests for pkg.contents.

---
 gentoopm/tests/pkg.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/gentoopm/tests/pkg.py b/gentoopm/tests/pkg.py
index 30bfb7a..1481167 100644
--- a/gentoopm/tests/pkg.py
+++ b/gentoopm/tests/pkg.py
@@ -105,5 +105,11 @@ class PackagesTestCase(PMTestCase):
 			self.assertEqual(p.metadata[rk], forkenv[rk])
 			del forkenv
 
+	def test_contents(self):
+		""" Test .contents. """
+		p = self._inst_pkg
+		f = next(iter(p.contents))
+		self.assertTrue(f in p.contents)
+
 	def tearDown(self):
 		pass



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2011-12-09 15:09 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2011-12-09 15:09 UTC (permalink / raw
  To: gentoo-commits

commit:     08cd9a3b4c28bed97513690dce2baf44d74f0700
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Dec  9 15:00:39 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Dec  9 15:00:39 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=08cd9a3b

Tests: use 'bash' as expected package, 'coreutils' is not used on *BSD.

---
 gentoopm/tests/__init__.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gentoopm/tests/__init__.py b/gentoopm/tests/__init__.py
index fd564e7..3d35562 100644
--- a/gentoopm/tests/__init__.py
+++ b/gentoopm/tests/__init__.py
@@ -69,10 +69,10 @@ class PackageNames(object):
 	switch to another packages when one of them stops to work.
 	"""
 
-	single = 'coreutils'
+	single = 'bash'
 	""" Incomplete atom matching a single package. """
 
-	single_complete = 'sys-apps/coreutils'
+	single_complete = 'app-shells/bash'
 	""" Complete atom matching a single package. """
 
 	multiple = 'pms'



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2012-01-09 16:09 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2012-01-09 16:09 UTC (permalink / raw
  To: gentoo-commits

commit:     80949d974663e453275d3f6a33ade7b1cccde15f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  9 16:09:04 2012 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jan  9 16:09:04 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=80949d97

Add a test for USEflag listing.

---
 gentoopm/tests/__init__.py |    3 +++
 gentoopm/tests/pkg.py      |    6 ++++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/gentoopm/tests/__init__.py b/gentoopm/tests/__init__.py
index 3d35562..8b1df9e 100644
--- a/gentoopm/tests/__init__.py
+++ b/gentoopm/tests/__init__.py
@@ -75,6 +75,9 @@ class PackageNames(object):
 	single_complete = 'app-shells/bash'
 	""" Complete atom matching a single package. """
 
+	single_use = 'nls'
+	""" A USEflag which should be available on the package above. """
+
 	multiple = 'pms'
 	""" Incomplete atom matching multiple packages. """
 

diff --git a/gentoopm/tests/pkg.py b/gentoopm/tests/pkg.py
index a5069ab..8e6697f 100644
--- a/gentoopm/tests/pkg.py
+++ b/gentoopm/tests/pkg.py
@@ -92,5 +92,11 @@ class PackagesTestCase(PMTestCase):
 		f = next(iter(p.contents))
 		self.assertTrue(f in p.contents)
 
+	def test_use(self):
+		""" Test .use. """
+		p = self._inst_pkg
+		fl = PackageNames.single_use
+		self.assertTrue(fl in p.use)
+
 	def tearDown(self):
 		pass



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2012-12-10 17:36 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2012-12-10 17:36 UTC (permalink / raw
  To: gentoo-commits

commit:     338e65dfc6f0de8079811e9b224e360c3bab6349
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 10 17:33:39 2012 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec 10 17:33:39 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=338e65df

Use relative imports in test loader.

This fixes one of the issues with Python 3.3.

---
 gentoopm/tests/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/tests/__init__.py b/gentoopm/tests/__init__.py
index 8b1df9e..3afd226 100644
--- a/gentoopm/tests/__init__.py
+++ b/gentoopm/tests/__init__.py
@@ -60,7 +60,7 @@ class PMTestLoader(unittest.TestLoader):
 
 	def loadTestsFromModule(self, mod):
 		if isinstance(mod, str):
-			mod = __import__(mod, fromlist=['.'], level=-1)
+			mod = __import__(mod, fromlist=['.'], level=2)
 		return unittest.TestLoader.loadTestsFromModule(self, mod)
 
 class PackageNames(object):


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2012-12-10 20:58 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2012-12-10 20:58 UTC (permalink / raw
  To: gentoo-commits

commit:     eb963f477a2fc5b88560d660764110f6744fc67c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 10 20:58:05 2012 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec 10 20:58:05 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=eb963f47

Finally actually fix Python 3.3.

---
 gentoopm/tests/__init__.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/gentoopm/tests/__init__.py b/gentoopm/tests/__init__.py
index 3afd226..82b15b7 100644
--- a/gentoopm/tests/__init__.py
+++ b/gentoopm/tests/__init__.py
@@ -60,7 +60,8 @@ class PMTestLoader(unittest.TestLoader):
 
 	def loadTestsFromModule(self, mod):
 		if isinstance(mod, str):
-			mod = __import__(mod, fromlist=['.'], level=2)
+			mod = __import__(mod, globals=globals(),
+					fromlist=['.'], level=0)
 		return unittest.TestLoader.loadTestsFromModule(self, mod)
 
 class PackageNames(object):


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2014-11-29  8:57 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2014-11-29  8:57 UTC (permalink / raw
  To: gentoo-commits

commit:     a1ff52849d993e56be281a45d4b6f104799a5b12
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 29 08:56:09 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Nov 29 08:56:09 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=a1ff5284

Unroll loops in tests for cleaner output

---
 gentoopm/tests/atom.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/gentoopm/tests/atom.py b/gentoopm/tests/atom.py
index c166d4d..74d1b28 100644
--- a/gentoopm/tests/atom.py
+++ b/gentoopm/tests/atom.py
@@ -14,8 +14,9 @@ class UserSpecifiedAtomTestCase(PMTestCase):
 		self._associated_atom = self.pm.stack.select(self._complete_atom)
 
 	def test_invalid_atoms(self):
-		for atstr in ('<>foo', '=bar', '*/*::baz'):
-			self.assertRaises(InvalidAtomStringError, self.pm.Atom, atstr)
+		self.assertRaises(InvalidAtomStringError, self.pm.Atom, '<>foo')
+		self.assertRaises(InvalidAtomStringError, self.pm.Atom, '=bar')
+		self.assertRaises(InvalidAtomStringError, self.pm.Atom, '*/*::baz')
 
 	def test_incomplete_atom(self):
 		a = self._incomplete_atom
@@ -26,9 +27,14 @@ class UserSpecifiedAtomTestCase(PMTestCase):
 		self.assertTrue(a.complete)
 
 	def test_atom_stringification(self):
-		for atstr in ('foo/bar', '>=baz/bar-100', 'foo/baz:10',
-				'bar/baz::foo', '>=foo/fooz-29.5:bazmania', '~baz/inga-4.1:2::foo'):
-			self.assertEqual(atstr, str(self.pm.Atom(atstr)))
+		self.assertEqual('foo/bar', str(self.pm.Atom('foo/bar')))
+		self.assertEqual('>=baz/bar-100', str(self.pm.Atom('>=baz/bar-100')))
+		self.assertEqual('foo/baz:10', str(self.pm.Atom('foo/baz:10')))
+		self.assertEqual('bar/baz::foo', str(self.pm.Atom('bar/baz::foo')))
+		self.assertEqual('>=foo/fooz-29.5:bazmania',
+			str(self.pm.Atom('>=foo/fooz-29.5:bazmania')))
+		self.assertEqual('~baz/inga-4.1:2::foo',
+			str(self.pm.Atom('~baz/inga-4.1:2::foo')))
 
 	def test_atom_transformations(self):
 		a = self._associated_atom


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2014-11-29  8:57 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2014-11-29  8:57 UTC (permalink / raw
  To: gentoo-commits

commit:     70effea11819a2509d5b9baea5e1c06e1352b01e
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 29 08:50:28 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Nov 29 08:50:28 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=70effea1

Fix tests now that bash is slotted

---
 gentoopm/tests/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gentoopm/tests/__init__.py b/gentoopm/tests/__init__.py
index 82b15b7..800d5ee 100644
--- a/gentoopm/tests/__init__.py
+++ b/gentoopm/tests/__init__.py
@@ -70,10 +70,10 @@ class PackageNames(object):
 	switch to another packages when one of them stops to work.
 	"""
 
-	single = 'bash'
+	single = 'make'
 	""" Incomplete atom matching a single package. """
 
-	single_complete = 'app-shells/bash'
+	single_complete = 'sys-devel/make'
 	""" Complete atom matching a single package. """
 
 	single_use = 'nls'


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
@ 2014-11-29  8:57 Michał Górny
  0 siblings, 0 replies; 18+ messages in thread
From: Michał Górny @ 2014-11-29  8:57 UTC (permalink / raw
  To: gentoo-commits

commit:     6a50f729eb34686f5749bde44d15b6c6fe91c59e
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 29 08:56:29 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Nov 29 08:56:29 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=6a50f729

Tests: don't assume '*/*::foo' is invalid

This atom is valid in Paludis, and there's probably no reason why it
wouldn't be valid in other PMs.

---
 gentoopm/tests/atom.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/gentoopm/tests/atom.py b/gentoopm/tests/atom.py
index 74d1b28..4c3841d 100644
--- a/gentoopm/tests/atom.py
+++ b/gentoopm/tests/atom.py
@@ -16,7 +16,6 @@ class UserSpecifiedAtomTestCase(PMTestCase):
 	def test_invalid_atoms(self):
 		self.assertRaises(InvalidAtomStringError, self.pm.Atom, '<>foo')
 		self.assertRaises(InvalidAtomStringError, self.pm.Atom, '=bar')
-		self.assertRaises(InvalidAtomStringError, self.pm.Atom, '*/*::baz')
 
 	def test_incomplete_atom(self):
 		a = self._incomplete_atom


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2014-11-29  8:57 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-15  9:52 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2014-11-29  8:57 Michał Górny
2014-11-29  8:57 Michał Górny
2014-11-29  8:57 Michał Górny
2012-12-10 20:58 Michał Górny
2012-12-10 17:36 Michał Górny
2012-01-09 16:09 Michał Górny
2011-12-09 15:09 Michał Górny
2011-07-25 17:06 Michał Górny
2011-07-20  9:41 Michał Górny
2011-07-19  9:56 Michał Górny
2011-07-19  9:56 Michał Górny
2011-07-17 22:19 Michał Górny
2011-07-15 13:32 Michał Górny
2011-07-15 13:32 Michał Górny
2011-07-15 12:34 Michał Górny
2011-07-15  9:52 Michał Górny
2011-07-15  9:52 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox