def test_verbose_output(self):
        actions = update._process_project(common.project_project,
                                          common.global_reqs, None, None, None,
                                          False)
        capture = StringIO.StringIO()
        project.write(common.project_project, actions, capture, True, True)
        expected = (
            """Syncing %(project)s/requirements.txt
Version change for: greenlet, SQLAlchemy, eventlet, PasteDeploy, routes, WebOb, wsgiref, boto, kombu, pycrypto, python-swiftclient, lxml, jsonschema, python-keystoneclient\n"""
            # noqa
            """Updated %(project)s/requirements.txt:
    greenlet>=0.3.1                ->   greenlet>=0.3.2
    SQLAlchemy>=0.7.8,<=0.7.99     ->   SQLAlchemy>=0.7,<=0.7.99
    eventlet>=0.9.12               ->   eventlet>=0.12.0
    PasteDeploy                    ->   PasteDeploy>=1.5.0
    routes                         ->   Routes>=1.12.3
    WebOb>=1.2                     ->   WebOb>=1.2.3,<1.3
    wsgiref                        ->   wsgiref>=0.1.2
    boto                           ->   boto>=2.4.0
    kombu>2.4.7                    ->   kombu>=2.4.8
    pycrypto>=2.1.0alpha1          ->   pycrypto>=2.6
    python-swiftclient>=1.2,<2     ->   python-swiftclient>=1.2
    lxml                           ->   lxml>=2.3
    jsonschema                     ->   jsonschema>=1.0.0,!=1.4.0,<2
    python-keystoneclient>=0.2.0   ->   python-keystoneclient>=0.4.1
Syncing %(project)s/test-requirements.txt
Version change for: mox, mox3, testrepository, testtools
Updated %(project)s/test-requirements.txt:
    mox==0.5.3                     ->   mox>=0.5.3
    mox3==0.7.3                    ->   mox3>=0.7.0
    testrepository>=0.0.13         ->   testrepository>=0.0.17
    testtools>=0.9.27              ->   testtools>=0.9.32
Syncing setup.py
""") % dict(project=common.project_project['root'])
        self.assertEqual(expected, capture.getvalue())
Example #2
0
    def test_verbose_output(self):
        actions = update._process_project(
            common.project_project, common.global_reqs, None, None, None,
            False)
        capture = six.StringIO()
        project.write(
            common.project_project, actions, capture, True, True)
        expected = ("""Syncing %(project)s/requirements.txt
Version change for: greenlet, SQLAlchemy, eventlet, PasteDeploy, routes, WebOb, wsgiref, boto, kombu, python-swiftclient, lxml, jsonschema, python-keystoneclient\n"""  # noqa
            """Updated %(project)s/requirements.txt:
    greenlet>=0.3.1                ->   greenlet>=0.3.2
    SQLAlchemy>=0.7.8,<=1.0.17     ->   SQLAlchemy<=0.7.99,>=0.7
    eventlet>=0.9.12               ->   eventlet>=0.12.0
    PasteDeploy                    ->   PasteDeploy>=1.5.0
    routes                         ->   Routes>=1.12.3
    WebOb>=1.2                     ->   WebOb<1.3,>=1.2.3
    wsgiref                        ->   wsgiref>=0.1.2
    boto                           ->   boto>=2.4.0
    kombu>2.4.7                    ->   kombu>=2.4.8
    python-swiftclient>=1.2,<4     ->   python-swiftclient>=1.2
    lxml                           ->   lxml>=2.3
    jsonschema                     ->   jsonschema!=1.4.0,<2,>=1.0.0
    python-keystoneclient>=0.2.0   ->   python-keystoneclient>=0.4.1
Syncing %(project)s/test-requirements.txt
Version change for: mox, mox3, testrepository, testtools
Updated %(project)s/test-requirements.txt:
    mox==0.5.3                     ->   mox>=0.5.3
    mox3==0.21.0                   ->   mox3>=0.7.0
    testrepository>=0.0.13         ->   testrepository>=0.0.17
    testtools>=0.9.27              ->   testtools>=0.9.32
Syncing setup.py
""") % dict(project=common.project_project['root'])
        self.assertEqual(expected, capture.getvalue())
Example #3
0
 def test_stdout(self):
     stdout = io.StringIO()
     root = self.useFixture(fixtures.TempDir()).path
     proj = {'root': root}
     actions = [project.StdOut(u'fred\n')]
     project.write(proj, actions, stdout, True)
     self.expectThat(stdout.getvalue(), matchers.Equals('fred\n'))
Example #4
0
 def test_bad_action(self):
     root = self.useFixture(fixtures.TempDir()).path
     stdout = io.StringIO()
     proj = {'root': root}
     actions = [('foo', 'bar')]
     with testtools.ExpectedException(Exception):
         project.write(proj, actions, stdout, True)
Example #5
0
 def test_non_verbose(self):
     stdout = io.StringIO()
     root = self.useFixture(fixtures.TempDir()).path
     proj = {'root': root}
     actions = [project.Verbose(u'fred')]
     project.write(proj, actions, stdout, False)
     self.expectThat(stdout.getvalue(), matchers.Equals(''))
Example #6
0
 def test_errors(self):
     stdout = io.StringIO()
     root = self.useFixture(fixtures.TempDir()).path
     proj = {'root': root}
     actions = [project.Error(u'fred')]
     with testtools.ExpectedException(Exception):
         project.write(proj, actions, stdout, True)
     self.expectThat(stdout.getvalue(), matchers.Equals('fred\n'))
Example #7
0
def _do_main(root, source, suffix, softupdate, hacking, stdout, verbose,
             non_std_reqs):
    """No options or environment variable access from here on in."""
    proj = project.read(root)
    global_req_content = open(os.path.join(source, 'global-requirements.txt'),
                              'rt').read()
    global_reqs = requirement.parse(global_req_content)
    actions = _process_project(proj, global_reqs, suffix, softupdate, hacking,
                               non_std_reqs)
    project.write(proj, actions, stdout=stdout, verbose=verbose)
Example #8
0
def _do_main(
        root, source, suffix, softupdate, hacking, stdout, verbose,
        non_std_reqs):
    """No options or environment variable access from here on in."""
    proj = project.read(root)
    global_req_content = open(
        os.path.join(source, 'global-requirements.txt'), 'rt').read()
    global_reqs = requirement.parse(global_req_content)
    actions = _process_project(
        proj, global_reqs, suffix, softupdate, hacking, non_std_reqs)
    project.write(proj, actions, stdout=stdout, verbose=verbose)
Example #9
0
 def test_smoke(self):
     stdout = io.StringIO()
     root = self.useFixture(fixtures.TempDir()).path
     proj = {'root': root}
     actions = [
         project.File('foo', '123\n'),
         project.File('bar', '456\n'),
         project.Verbose(u'fred')]
     project.write(proj, actions, stdout, True)
     foo = open(root + '/foo', 'rt').read()
     self.expectThat(foo, matchers.Equals('123\n'))
     bar = open(root + '/bar', 'rt').read()
     self.expectThat(bar, matchers.Equals('456\n'))
     self.expectThat(stdout.getvalue(), matchers.Equals('fred\n'))