[pypy-svn] buildbot default: simplify the duplicate avoidance tests

RonnyPfannschmidt commits-noreply at bitbucket.org
Wed Apr 20 15:54:05 CEST 2011


Author: Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
Branch: 
Changeset: r483:cc63f7889d1f
Date: 2011-04-20 12:13 +0200
http://bitbucket.org/pypy/buildbot/changeset/cc63f7889d1f/

Log:	simplify the duplicate avoidance tests

diff --git a/bitbucket_hook/test/test_hook.py b/bitbucket_hook/test/test_hook.py
--- a/bitbucket_hook/test/test_hook.py
+++ b/bitbucket_hook/test/test_hook.py
@@ -154,11 +154,7 @@
 
 
 def test_ignore_duplicate_commits(monkeypatch, mails, messages):
-    def hg(*args):
-        return '<hg %s>' % ' '.join(map(str, args))
-    monkeypatch.setattr(scm, 'hg', hg)
     monkeypatch.setattr(hook, 'seen_nodes', set())
-    monkeypatch.setattr(hook, 'check_for_local_repo', lambda _: True)
 
     commits, _ = irc_cases()
     payload = {u'repository': {u'absolute_url': '',
@@ -168,9 +164,9 @@
                                u'website': u''},
                u'user': u'antocuni',
                'commits': commits['commits']}
-    hook.handle(payload)
-    hook.handle(payload)
-    #
+    commits_listed = list(hook.get_commits('test', payload))
+    commits_again = list(hook.get_commits('test', payload))
     num_commits = len(commits['commits'])
-    assert len(mails) == num_commits
-    assert len(messages) == num_commits
+    assert len(commits_listed) == num_commits
+    assert not commits_again
+


More information about the Pypy-commit mailing list