def test_no_install_setup(self): actions = update._process_project( common.oslo_project, common.global_reqs, 'global', None, None, False) for action in actions: if type(action) is update.File: self.assertNotEqual(action.filename, 'setup.py')
def test_verbose_output(self): actions = update._process_project( common.project_project, common.global_reqs, None, None, None, False) capture = StringIO.StringIO() update._write_project( 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 project_file( fail, project, action_filename, suffix=None, softupdate=None, non_std_reqs=False): actions = update._process_project( project, global_reqs, suffix, softupdate, None, non_std_reqs) for action in actions: if type(action) is update.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): with testtools.ExpectedException(Exception): update._process_project( common.bad_project, common.global_reqs, None, None, None, False)
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 update.Error] msg = u"'thisisnotarealdepedency' is not in global-requirements.txt" self.assertEqual([update.Error(message=msg)], errors)