def test_suffix(self, mock_isdir): def check_params(root, source, suffix, softupdate, hacking, stdout, verbose, non_std_reqs): self.expectThat(suffix, matchers.Equals('global')) update.main(['-o', 'global', '/dev/zero'], _worker=check_params) self.expectThat(mock_isdir.called, matchers.Equals(True))
def test_suffix(self): def check_params( root, source, suffix, softupdate, hacking, stdout, verbose, non_std_reqs): self.expectThat(suffix, matchers.Equals('global')) update.main(['-o', 'global', '/dev/zero'], _worker=check_params)
def test_isdirectory(self): def never_called( root, source, suffix, softupdate, hacking, stdout, verbose, non_std_reqs): self.expectThat(False, matchers.Equals(True), message=("update.main() should riase an " "exception before getting here")) with testtools.ExpectedException(Exception, "/dev/zero is not a directory"): update.main(['/dev/zero'], _worker=never_called)
def test_isdirectory(self): def never_called(root, source, suffix, softupdate, hacking, stdout, verbose, non_std_reqs): self.expectThat(False, matchers.Equals(True), message=("update.main() should riase an " "excpetion before getting here")) with testtools.ExpectedException(Exception, "/dev/zero is not a directory"): update.main(['/dev/zero'], _worker=never_called)
def test_smoke(self): def check_params(root, source, suffix, softupdate, hacking, stdout, verbose, non_std_reqs): self.expectThat(root, matchers.Equals('/dev/zero')) self.expectThat(source, matchers.Equals('/dev/null')) self.expectThat(suffix, matchers.Equals('')) self.expectThat(softupdate, matchers.Equals(None)) self.expectThat(hacking, matchers.Equals(None)) self.expectThat(stdout, matchers.Equals(sys.stdout)) self.expectThat(verbose, matchers.Equals(None)) self.expectThat(non_std_reqs, matchers.Equals(True)) with fixtures.EnvironmentVariable('NON_STANDARD_REQS', '1'): update.main(['--source', '/dev/null', '/dev/zero'], _worker=check_params)
def test_smoke(self): def check_params( root, source, suffix, softupdate, hacking, stdout, verbose, non_std_reqs): self.expectThat(root, matchers.Equals('/dev/zero')) self.expectThat(source, matchers.Equals('/dev/null')) self.expectThat(suffix, matchers.Equals('')) self.expectThat(softupdate, matchers.Equals(None)) self.expectThat(hacking, matchers.Equals(None)) self.expectThat(stdout, matchers.Equals(sys.stdout)) self.expectThat(verbose, matchers.Equals(None)) self.expectThat(non_std_reqs, matchers.Equals(True)) with fixtures.EnvironmentVariable('NON_STANDARD_REQS', '1'): update.main( ['--source', '/dev/null', '/dev/zero'], _worker=check_params)
def test_project(self): global_env = self.useFixture(common.GlobalRequirements()) global_reqs = common._file_to_list(global_env.req_file) # This is testing our test input data. Perhaps remove? (lifeless) self.assertIn("jsonschema>=1.0.0,!=1.4.0,<2", global_reqs) # And test the end to end call of update.py, UI and all. self.project = self.useFixture(common.project_fixture) capture = StringIO.StringIO() update.main(['--source', global_env.root, self.project.root], capture) reqs = common._file_to_list(self.project.req_file) # ensure various updates take self.assertIn("jsonschema!=1.4.0,<2,>=1.0.0", reqs) self.assertIn("python-keystoneclient>=0.4.1", reqs) self.assertIn("SQLAlchemy<=0.7.99,>=0.7", reqs) expected = ( '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 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 """) % dict(project=self.project.root) self.assertEqual(expected, capture.getvalue())
def test_project(self): global_env = self.useFixture(common.GlobalRequirements()) global_reqs = common._file_to_list(global_env.req_file) # This is testing our test input data. Perhaps remove? (lifeless) self.assertIn("jsonschema!=1.4.0,<2,>=1.0.0", global_reqs) # And test the end to end call of update.py, UI and all. self.project = self.useFixture(common.project_fixture) capture = six.StringIO() update.main(['--source', global_env.root, self.project.root], capture) reqs = common._file_to_list(self.project.req_file) # ensure various updates take self.assertIn("jsonschema!=1.4.0,<2,>=1.0.0", reqs) self.assertIn("python-keystoneclient>=0.4.1", reqs) self.assertIn("SQLAlchemy<=0.7.99,>=0.7", reqs) expected = ('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.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 pycrypto>=2.1.0alpha1 -> pycrypto>=2.6 python-swiftclient>=1.2,<2 -> 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 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 """) % dict(project=self.project.root) self.assertEqual(expected, capture.getvalue())