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())
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())
def test_no_install_setup(self): actions = update._process_project( common.oslo_project, common.global_reqs, None, None, None, False) for action in actions: if type(action) is project.File: self.assertNotEqual(action.filename, 'setup.py')
def test_requirement_not_in_global(self): actions = update._process_project(common.bad_project, common.global_reqs, None, None, None, False) errors = [a for a in actions if type(a) is project.Error] msg = u"'thisisnotarealdepedency' is not in global-requirements.txt" self.assertEqual([project.Error(message=msg)], errors)
def test_no_install_setup(self): actions = update._process_project(common.oslo_project, common.global_reqs, None, None, None, False) for action in actions: if type(action) is project.File: self.assertNotEqual(action.filename, 'setup.py')
def project_file( fail, proj, action_filename, suffix=None, softupdate=None, non_std_reqs=False, blacklist={}): actions = update._process_project( proj, global_reqs, suffix, softupdate, None, non_std_reqs, blacklist) for action in actions: if type(action) is project.File: if action.filename == action_filename: return action.content.splitlines() fail('File %r not found in %r' % (action_filename, actions))
def test_requirement_in_blacklist(self): actions = update._process_project( common.bad_project, common.global_reqs, None, None, None, False, blacklist={'thisisnotarealdependency': None}) errors = [a for a in actions if type(a) is project.Error] self.assertEqual([], errors)
def project_file( fail, proj, action_filename, suffix=None, softupdate=None, non_std_reqs=False): actions = update._process_project( proj, global_reqs, suffix, softupdate, None, non_std_reqs) for action in actions: if type(action) is project.File: if action.filename == action_filename: return action.content.splitlines() fail('File %r not found in %r' % (action_filename, actions))
def test_requirement_not_in_global(self): actions = update._process_project( common.bad_project, common.global_reqs, None, None, None, False) errors = [a for a in actions if type(a) is project.Error] msg = u"'thisisnotarealdependency' is not in global-requirements.txt" self.assertIn(msg, errors[0].message)