public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/
Date: Fri, 15 Jul 2011 09:52:26 +0000 (UTC)	[thread overview]
Message-ID: <96d43547ff234a34aa2c8dff8c981662d5cd5e5d.mgorny@gentoo> (raw)

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)
 



             reply	other threads:[~2011-07-15  9:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-15  9:52 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-11-29  8:57 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/tests/ 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=96d43547ff234a34aa2c8dff8c981662d5cd5e5d.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox