Merge lp:~wgrant/juju-deployer/test-fixes into lp:juju-deployer

Proposed by William Grant
Status: Merged
Merged at revision: 202
Proposed branch: lp:~wgrant/juju-deployer/test-fixes
Merge into: lp:juju-deployer
Diff against target: 39 lines (+11/-0)
2 files modified
deployer/tests/test_charm.py (+10/-0)
setup.py (+1/-0)
To merge this branch: bzr merge lp:~wgrant/juju-deployer/test-fixes
Reviewer Review Type Date Requested Status
Tim Van Steenburgh (community) Approve
Review via email: mp+310021@code.launchpad.net

Commit message

Two fixes to make running tests easier.

Description of the change

Two fixes to make running tests easier: isolate the testrunner's bzr and git configs (preventing eg. clobbering of whoami, or failures due to create_signatures=always), and declare the test dependency on mock.

To post a comment you must log in.
Revision history for this message
Tim Van Steenburgh (tvansteenburgh) wrote :

LGTM, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'deployer/tests/test_charm.py'
2--- deployer/tests/test_charm.py 2016-10-24 16:49:55 +0000
3+++ deployer/tests/test_charm.py 2016-11-04 00:24:53 +0000
4@@ -92,6 +92,11 @@
5 class BzrCharmTest(Base):
6
7 def setUp(self):
8+ # Isolate tests from the user's bzr config.
9+ orig_home = os.environ.get('HOME')
10+ os.environ['HOME'] = self.mkdir()
11+ self.addCleanup(os.environ.update, {'HOME': orig_home})
12+
13 self.repo_path = d = self.mkdir()
14 self.series_path = os.path.join(d, "precise")
15 os.mkdir(self.series_path)
16@@ -237,6 +242,11 @@
17 class GitCharmTest(Base):
18
19 def setUp(self):
20+ # Isolate tests from the user's git config.
21+ orig_home = os.environ.get('HOME')
22+ os.environ['HOME'] = self.mkdir()
23+ self.addCleanup(os.environ.update, {'HOME': orig_home})
24+
25 self.repo_path = d = self.mkdir()
26 self.series_path = os.path.join(d, "precise")
27 os.mkdir(self.series_path)
28
29=== modified file 'setup.py'
30--- setup.py 2016-10-25 15:56:18 +0000
31+++ setup.py 2016-11-04 00:24:53 +0000
32@@ -11,6 +11,7 @@
33 author_email="kapil.foss@gmail.com",
34 url="http://launchpad.net/juju-deployer",
35 install_requires=["jujuclient>=0.53", "PyYAML>=3.10", "six"],
36+ extras_require={"test": ["mock"]},
37 packages=find_packages(),
38 classifiers=[
39 "Development Status :: 4 - Beta",

Subscribers

People subscribed via source and target branches