def test(self):
        self.layer['pypi'] = {
            'requests': '2.3.0',
            'setuptools': '0.7',
            'zope.component': '4.2.1',
            'zope.interface': '5.0.0',
            'zope.annotation': '4.2.0'}

        fshelpers.create_structure(self.tempdir, {
                'versions.cfg': VERSIONS_CONFIG})

        output = StringIO()
        with capture_streams(output):
            main(buildout_dir=self.tempdir,
                 versions='versions.cfg',
                 blacklists=(BLACKLIST_URL,),
                 blacklist_packages=('zope.annotation', ))

        self.assertMultiLineEqual(
            '\n'.join(
                ('[versions]',
                 'requests = 2.3.0                         # was 2.0.0',
                 # 'setuptools = 0.6c11',  # blacklisted
                 # 'zope.component = 4.2.1',   # no new version
                 'zope.interface = 5.0.0                   # was 4.1.0',
                 )),
            output.getvalue().strip())
Exemplo n.º 2
0
    def test(self):
        self.layer['pypi'] = {
            'requests': '2.3.0',
            'setuptools': '0.7',
            'zope.component': '4.2.1',
            'zope.interface': '5.0.0',
            'zope.annotation': '4.2.0'
        }

        fshelpers.create_structure(self.tempdir,
                                   {'versions.cfg': VERSIONS_CONFIG})

        output = StringIO()
        with capture_streams(output):
            main(buildout_dir=self.tempdir,
                 versions='versions.cfg',
                 blacklists=(BLACKLIST_URL, ),
                 blacklist_packages=('zope.annotation', ))

        self.assertMultiLineEqual(
            '\n'.join((
                '[versions]',
                'requests = 2.3.0                         # was 2.0.0',
                # 'setuptools = 0.6c11',  # blacklisted
                # 'zope.component = 4.2.1',   # no new version
                'zope.interface = 5.0.0                   # was 4.1.0',
            )),
            output.getvalue().strip())
 def test_captures_all_streams_parallel(self):
     stdout = StringIO()
     stderr = StringIO()
     with utils.capture_streams(stdout=stdout, stderr=stderr):
         print 'Foo'
         print >> sys.stderr, 'Bar'
     self.assertEquals('Foo\n', stdout.getvalue())
     self.assertEquals('Bar\n', stderr.getvalue())
 def test_captures_all_streams_parallel(self):
     stdout = StringIO()
     stderr = StringIO()
     with utils.capture_streams(stdout=stdout, stderr=stderr):
         print 'Foo'
         print >> sys.stderr, 'Bar'
     self.assertEquals('Foo\n', stdout.getvalue())
     self.assertEquals('Bar\n', stderr.getvalue())
def read_versions(buildout_directory, filename_or_url):
    """Read a buildout configuration from a file or an URL and
    return the version-pinnings from the [versions] section as
    dict.
    """
    with capture_streams(stdout=sys.stderr):
        if _isurl(filename_or_url):
            buildout = load_buildout_from_url(filename_or_url)
        else:
            buildout = load_buildout_from_file(buildout_directory,
                                               filename_or_url)

    return buildout['versions']
 def test_captures_stdout(self):
     stdout = StringIO()
     with utils.capture_streams(stdout=stdout):
         print 'Foo'
     self.assertEquals('Foo\n', stdout.getvalue())
 def test_captures_stderr(self):
     stderr = StringIO()
     with utils.capture_streams(stderr=stderr):
         print >> sys.stderr, 'Error'
     self.assertEquals('Error\n', stderr.getvalue())
 def test_captures_stdout(self):
     stdout = StringIO()
     with utils.capture_streams(stdout=stdout):
         print 'Foo'
     self.assertEquals('Foo\n', stdout.getvalue())
 def test_captures_stderr(self):
     stderr = StringIO()
     with utils.capture_streams(stderr=stderr):
         print >> sys.stderr, 'Error'
     self.assertEquals('Error\n', stderr.getvalue())