summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <g.guenther@tarent.de>2011-10-28 10:14:34 +0200
committerGuido Günther <agx@sigxcpu.org>2011-10-28 18:48:19 +0200
commit3d80c335ecbac1db0826d9d5d03fe36b92ccf62d (patch)
tree019cec6b207fa181d1b53ceba46c5aded7497888
parenta4aa2b78c7b68de7058e385fd20dfc53f9699eff (diff)
GitModifier: Don't use self.__dict__.update(locals())
to make pychecker happy
-rwxr-xr-xdebian/rules2
-rw-r--r--gbp/git.py4
-rw-r--r--tests/test_GitModifier.py23
3 files changed, 27 insertions, 2 deletions
diff --git a/debian/rules b/debian/rules
index a2bc921..d70542f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -54,7 +54,7 @@ links_stamp:
apidocs: links_stamp
epydoc -v -n git-buildpackage --no-sourcecode -o docs/apidocs/ \
- gbp*.py git*.py gbp/ tests/test_GitRepository.py
+ gbp*.py git*.py gbp/ tests/test_Git*.py
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
pychecker:
diff --git a/gbp/git.py b/gbp/git.py
index 48e9366..d4192f0 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -33,7 +33,9 @@ class GitRepositoryError(Exception):
class GitModifier(object):
"""Stores authorship/comitter information"""
def __init__(self, name=None, email=None, date=None):
- self.__dict__.update(locals())
+ self.name = name
+ self.email = email
+ self.date = date
def _get_env(self, who):
"""Get author or comitter information as env var dictionary"""
diff --git a/tests/test_GitModifier.py b/tests/test_GitModifier.py
new file mode 100644
index 0000000..10188a0
--- /dev/null
+++ b/tests/test_GitModifier.py
@@ -0,0 +1,23 @@
+# vim: set fileencoding=utf-8 :
+
+"""
+Test L{gbp.git.GitModifier}
+"""
+
+def test_author():
+ """
+ Methods tested:
+ - L{gbp.git.GitModifer.get_author_env}
+ - L{gbp.git.GitModifer.get_comitter_env}
+
+ >>> import gbp.git
+ >>> modifier = gbp.git.GitModifier("foo", "bar")
+ >>> modifier.name
+ 'foo'
+ >>> modifier.email
+ 'bar'
+ >>> modifier.get_author_env()
+ {'GIT_AUTHOR_EMAIL': 'bar', 'GIT_AUTHOR_NAME': 'foo'}
+ >>> modifier.get_committer_env()
+ {'GIT_COMMITTER_NAME': 'foo', 'GIT_COMMITTER_EMAIL': 'bar'}
+ """