allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [3/5] allura git commit: Make these test classes runnable on their own (they happen to pass if other stuff runs first)
Date Wed, 28 Sep 2016 16:01:14 GMT
Make these test classes runnable on their own (they happen to pass if other stuff runs first)


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/f0d25f42
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/f0d25f42
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/f0d25f42

Branch: refs/heads/master
Commit: f0d25f42b22ab24a66adf3183b4c5a4882b135f8
Parents: 699e8ae
Author: Dave Brondsema <dave@brondsema.net>
Authored: Wed Sep 21 14:28:36 2016 -0400
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Wed Sep 28 11:54:57 2016 -0400

----------------------------------------------------------------------
 .../forgeimporters/tests/forge/test_tracker.py         | 13 ++++++++++---
 .../forgeimporters/tests/github/test_tracker.py        | 10 ++++++++++
 2 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/f0d25f42/ForgeImporters/forgeimporters/tests/forge/test_tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/forge/test_tracker.py b/ForgeImporters/forgeimporters/tests/forge/test_tracker.py
index e985763..9be7743 100644
--- a/ForgeImporters/forgeimporters/tests/forge/test_tracker.py
+++ b/ForgeImporters/forgeimporters/tests/forge/test_tracker.py
@@ -17,8 +17,6 @@
 
 from datetime import datetime
 from unittest import TestCase
-from cgi import FieldStorage
-from cStringIO import StringIO
 
 import mock
 from ming.odm import ThreadLocalORMSession
@@ -29,11 +27,20 @@ from allura.tests.decorators import with_tracker
 
 from allura import model as M
 from forgeimporters.forge import tracker
-from forgetracker import model as TM
 
 
 class TestTrackerImporter(TestCase):
 
+    def setUp(self):
+        super(TestTrackerImporter, self).setUp()
+        # every single test method here creates an importer and ToolImporterMeta uses 'g'
+        self.patcher_g = mock.patch('forgeimporters.base.g', mock.MagicMock())
+        self.patcher_g.start()
+
+    def tearDown(self):
+        super(TestTrackerImporter, self).tearDown()
+        self.patcher_g.stop()
+
     @mock.patch.object(tracker, 'File')
     @mock.patch.object(tracker.h, 'make_app_admin_only')
     @mock.patch.object(tracker, 'g')

http://git-wip-us.apache.org/repos/asf/allura/blob/f0d25f42/ForgeImporters/forgeimporters/tests/github/test_tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/github/test_tracker.py b/ForgeImporters/forgeimporters/tests/github/test_tracker.py
index e02ac5a..fd7df5c 100644
--- a/ForgeImporters/forgeimporters/tests/github/test_tracker.py
+++ b/ForgeImporters/forgeimporters/tests/github/test_tracker.py
@@ -26,6 +26,16 @@ from forgeimporters.github.utils import GitHubMarkdownConverter
 
 class TestTrackerImporter(TestCase):
 
+    def setUp(self):
+        super(TestTrackerImporter, self).setUp()
+        # every single test method here creates an importer and ToolImporterMeta uses 'g'
+        self.patcher_g = mock.patch('forgeimporters.base.g', mock.MagicMock())
+        self.patcher_g.start()
+
+    def tearDown(self):
+        super(TestTrackerImporter, self).tearDown()
+        self.patcher_g.stop()
+
     @mock.patch.object(tracker, 'g')
     @mock.patch.object(tracker, 'c')
     @mock.patch.object(tracker, 'ThreadLocalORMSession')


Mime
View raw message