diff options
author | Priit Laes <plaes@plaes.org> | 2010-08-10 11:20:39 +0300 |
---|---|---|
committer | Priit Laes <plaes@plaes.org> | 2010-08-10 11:20:39 +0300 |
commit | e1deb98706cb71d59bd9ebb91e48f075bd752cdb (patch) | |
tree | cac2b2980243ec22901e0b0d2e664ffa45b9ca74 /grumpy/testsuite | |
parent | Added preliminary version bump check plugins (diff) | |
download | gsoc2010-grumpy-e1deb98706cb71d59bd9ebb91e48f075bd752cdb.tar.gz gsoc2010-grumpy-e1deb98706cb71d59bd9ebb91e48f075bd752cdb.tar.bz2 gsoc2010-grumpy-e1deb98706cb71d59bd9ebb91e48f075bd752cdb.zip |
Improve package creation utility for unittests
Diffstat (limited to 'grumpy/testsuite')
-rw-r--r-- | grumpy/testsuite/__init__.py | 9 | ||||
-rw-r--r-- | grumpy/testsuite/pkgmodel.py | 10 |
2 files changed, 10 insertions, 9 deletions
diff --git a/grumpy/testsuite/__init__.py b/grumpy/testsuite/__init__.py index 7fcecd9..d5992e4 100644 --- a/grumpy/testsuite/__init__.py +++ b/grumpy/testsuite/__init__.py @@ -8,11 +8,12 @@ :copyright: (c) by 2010 Priit Laes. :license: BSD, see LICENSE for details. """ -import unittest +import copy, unittest + +from pkgcore.ebuild import ebuild_src, repo_objs from grumpy import app from grumpy.models import db -from pkgcore.ebuild import ebuild_src, repo_objs class GrumpyTestCase(unittest.TestCase): @@ -23,7 +24,7 @@ class GrumpyTestCase(unittest.TestCase): for x in valid_keys: pkg_data.setdefault(x, "") metadata = repo_objs.MetadataXml(None) - for key, value in pkg_data.iteritems(): + for key, value in copy.copy(pkg_data).iteritems(): if key not in valid_keys: continue object.__setattr__(metadata, "_" + key, value) @@ -31,7 +32,7 @@ class GrumpyTestCase(unittest.TestCase): o = ebuild_src.package(shared_pkg_data, None, cpv) if data is not None: - object.__setattr__(o, 'data', data) + object.__setattr__(o, 'data', copy.copy(data)) return o def setUp(self): diff --git a/grumpy/testsuite/pkgmodel.py b/grumpy/testsuite/pkgmodel.py index 1d73435..bd9f26b 100644 --- a/grumpy/testsuite/pkgmodel.py +++ b/grumpy/testsuite/pkgmodel.py @@ -13,7 +13,7 @@ from . import GrumpyTestCase from pkgcore.ebuild.repo_objs import Maintainer from grumpy.models import Category, Developer, Ebuild, Herd, Package -import copy, unittest +import unittest class PkgModelTestCase(GrumpyTestCase): @@ -30,9 +30,9 @@ class PkgModelTestCase(GrumpyTestCase): 'herds': (None, '', 'kala', 'test'), \ 'maintainers': (Maintainer('test@gentoo.org'), Maintainer('nobody@gentoo.org')) } - p1 = self.get_pkg('%s/testpkg-1.0-r3' % C1, sdata, copy.copy(data)) + p1 = self.get_pkg('%s/testpkg-1.0-r3' % C1, sdata, data) data['KEYWORDS'] = 'x86 ~amd64' - p2 = self.get_pkg('%s/testpkg-1.0-r4' % C1, sdata, copy.copy(data)) + p2 = self.get_pkg('%s/testpkg-1.0-r4' % C1, sdata, data) # app-test/testpkg C2 = 'app-test' @@ -41,7 +41,7 @@ class PkgModelTestCase(GrumpyTestCase): 'HOMEPAGE': 'http://example.org/testpkg-app-test', \ 'KEYWORDS':'x86 ~amd64', \ 'IUSE':'test +positive flags -negative split-flag'} - p3 = self.get_pkg('%s/testpkg-1.0-r3' % C2, sdata, copy.copy(data)) + p3 = self.get_pkg('%s/testpkg-1.0-r3' % C2, sdata, data) with self.app.test_request_context(): ## Create and test categories @@ -80,7 +80,7 @@ class PkgModelTestCase(GrumpyTestCase): # Test changes in herds sdata['herds'] = () - px = self.get_pkg('%s/testpkg-1.0-r3' % C1, sdata, copy.copy(data)) + px = self.get_pkg('%s/testpkg-1.0-r3' % C1, sdata, data) c[0].packages[px.key].sync(px) self.db.session.commit() |