~brian-murray/apport/support-ppa-packages

« back to all changes in this revision

Viewing changes to test/test_backend_apt_dpkg.py

  • Committer: Martin Pitt
  • Date: 2015-05-28 14:01:10 UTC
  • Revision ID: martin.pitt@canonical.com-20150528140110-ig6thxh15ofp4uka
Fix backend_apt_dpkg.test_install_packages_permanent_sandbox test to restore proxy settings at the right time

Show diffs side-by-side

added added

removed removed

Lines of Context:
749
749
            del os.environ['no_proxy']
750
750
        except KeyError:
751
751
            orig_no_proxy = None
 
752
 
752
753
        self.assertRaises(SystemExit, impl.install_packages, self.rootdir,
753
754
                          self.configdir, 'Foonux 1.2', [('libc6', None)], False,
754
755
                          self.cachedir, permanent_rootdir=True)
755
 
        if orig_http_proxy:
756
 
            os.environ['http_proxy'] = orig_http_proxy
757
 
        else:
758
 
            del os.environ['http_proxy']
759
 
        if orig_no_proxy:
760
 
            os.environ['no_proxy'] = orig_no_proxy
761
756
 
762
757
        # These packages exist, so attempting to install them should not fail.
763
758
        impl.install_packages(self.rootdir, self.configdir, 'Foonux 1.2',
776
771
                          self.configdir, 'Foonux 1.2', [('aspell-doc', None)], False,
777
772
                          self.cachedir, permanent_rootdir=True)
778
773
 
 
774
        # restore original proxy settings
 
775
        if orig_http_proxy:
 
776
            os.environ['http_proxy'] = orig_http_proxy
 
777
        else:
 
778
            del os.environ['http_proxy']
 
779
        if orig_no_proxy:
 
780
            os.environ['no_proxy'] = orig_no_proxy
779
781
        apt_pkg.config.set('Acquire::http::Proxy', orig_apt_proxy)
780
782
 
781
783
    @unittest.skipUnless(_has_internet(), 'online test')