Merge lp:~gz/pyjuju/0.6_test_lsbrelease_backport into lp:pyjuju/0.6

Proposed by Martin Packman on 2013-04-02
Status: Merged
Merged at revision: 597
Proposed branch: lp:~gz/pyjuju/0.6_test_lsbrelease_backport
Merge into: lp:pyjuju/0.6
Diff against target: 47 lines (+7/-6)
1 file modified
juju/charm/tests/test_directory.py (+7/-6)
To merge this branch: bzr merge lp:~gz/pyjuju/0.6_test_lsbrelease_backport
Reviewer Review Type Date Requested Status
Martin Packman (community) Approve on 2013-04-03
Review via email: mp+156594@code.launchpad.net

Description of the change

Backport of test suite only fix for 0.6 release.

See the original merge proposal for more details:

<https://code.launchpad.net/~clint-fewbar/juju/no-lsb-release/+merge/130929>

To post a comment you must log in.
Martin Packman (gz) wrote :

Test suite passes with change.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'juju/charm/tests/test_directory.py'
2--- juju/charm/tests/test_directory.py 2012-09-14 15:33:33 +0000
3+++ juju/charm/tests/test_directory.py 2013-04-02 15:03:21 +0000
4@@ -3,7 +3,6 @@
5 import hashlib
6 import inspect
7 import shutil
8-import tempfile
9 import zipfile
10
11 from juju.errors import CharmError, FileNotFound
12@@ -111,12 +110,12 @@
13 def test_make_archive(self):
14 # make archive from sample directory
15 directory = CharmDirectory(sample_directory)
16- f = tempfile.NamedTemporaryFile(suffix=".charm")
17- directory.make_archive(f.name)
18+ f = self.makeFile(suffix=".charm")
19+ directory.make_archive(f)
20
21 # open archive in .zip-format and assert integrity
22 from zipfile import ZipFile
23- zf = ZipFile(f.name)
24+ zf = ZipFile(f)
25 self.assertEqual(zf.testzip(), None)
26
27 # assert included
28@@ -212,7 +211,8 @@
29
30 def test_internal_symlink(self):
31 charm_path = self.copy_charm()
32- os.symlink("/etc/lsb-release", os.path.join(charm_path, "foobar"))
33+ external_file = self.makeFile(content='baz')
34+ os.symlink(external_file, os.path.join(charm_path, "foobar"))
35
36 directory = CharmDirectory(charm_path)
37 e = self.assertRaises(InvalidCharmFile, directory.as_bundle)
38@@ -220,7 +220,8 @@
39
40 def test_extract_symlink(self):
41 charm_path = self.copy_charm()
42- os.symlink("/etc/lsb-release", os.path.join(charm_path, "foobar"))
43+ external_file = self.makeFile(content='lorem ipsum')
44+ os.symlink(external_file, os.path.join(charm_path, "foobar"))
45
46 directory = CharmDirectory(charm_path)
47 e = self.assertRaises(InvalidCharmFile, directory.as_bundle)

Subscribers

People subscribed via source and target branches