~snappy-dev/snapcraft/core

« back to all changes in this revision

Viewing changes to snapcraft/tests/test_sources.py

  • Committer: Sergio Schvezov
  • Date: 2015-10-14 18:14:47 UTC
  • mto: This revision was merged to the branch mainline in revision 239.
  • Revision ID: sergio.schvezov@canonical.com-20151014181447-od7wvy8vyit1zf10
Run unit tests when building the deb and make a failing test work

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
class TestTar(tests.TestCase):
42
42
 
43
43
    def test_pull_tarball_must_download_to_sourcedir(self):
44
 
        server = http.server.HTTPServer(('', 0), FakeTarballHTTPRequestHandler)
 
44
        os.environ['no_proxy'] = '127.0.0.1'
 
45
        server = http.server.HTTPServer(
 
46
            ('127.0.0.1', 0), FakeTarballHTTPRequestHandler)
45
47
        server_thread = threading.Thread(target=server.serve_forever)
46
48
        self.addCleanup(server_thread.join)
47
49
        self.addCleanup(server.server_close)
56
58
            *server.server_address, file_name=tar_file_name)
57
59
        tar_source = sources.Tar(source, dest_dir)
58
60
 
59
 
        tar_source.pull()
 
61
        self.assertTrue(tar_source.pull())
60
62
 
61
63
        with open(os.path.join(dest_dir, tar_file_name), 'r') as tar_file:
62
64
            self.assertEqual('Test fake tarball file', tar_file.read())