Merge lp:~dpb/tarmac/fix-odd-unit-test-bug-1258248 into lp:tarmac

Proposed by David Britton
Status: Merged
Approved by: dobey
Approved revision: 430
Merged at revision: 429
Proposed branch: lp:~dpb/tarmac/fix-odd-unit-test-bug-1258248
Merge into: lp:tarmac
Diff against target: 18 lines (+5/-4)
1 file modified
tarmac/tests/test_plugin.py (+5/-4)
To merge this branch: bzr merge lp:~dpb/tarmac/fix-odd-unit-test-bug-1258248
Reviewer Review Type Date Requested Status
dobey Approve
Review via email: mp+208700@code.launchpad.net

Commit message

Use isolated test modules so as not to pollute import environment for tests down the line.

Description of the change

Fix for unit test bug described in the attached bug. Use isolated test modules so as not to pollute import environment for tests down the line.

To post a comment you must log in.
Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tarmac/tests/test_plugin.py'
2--- tarmac/tests/test_plugin.py 2013-11-06 14:53:03 +0000
3+++ tarmac/tests/test_plugin.py 2014-02-27 22:27:53 +0000
4@@ -72,9 +72,10 @@
5 @patch('tarmac.plugin.execfile', create=True)
6 def test_load_plugins(self, mocked):
7 """Test that plug-ins load."""
8- for _plugin in plugin.find_plugins():
9- delattr(_mod_plugins, _plugin[0])
10- self.addCleanup(delattr, _mod_plugins, _plugin[0])
11-
12+ plugin_path = os.path.join(os.path.dirname(__file__), 'plugins')
13+ self._patch_env('TARMAC_PLUGIN_PATH',
14+ '%s:%s' % (plugin_path, plugin_path))
15+ plugin_name = 'testplugin'
16+ self.addCleanup(delattr, _mod_plugins, plugin_name)
17 plugin.load_plugins()
18 self.assertTrue(mocked.call_count > 0)

Subscribers

People subscribed via source and target branches