]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Merge "Fix dhcp _test_sync_state_helper asserting calls wrong"
authorJenkins <jenkins@review.openstack.org>
Fri, 29 May 2015 17:43:40 +0000 (17:43 +0000)
committerGerrit Code Review <review@openstack.org>
Fri, 29 May 2015 17:43:40 +0000 (17:43 +0000)
1  2 
neutron/hacking/checks.py
neutron/tests/unit/agent/dhcp/test_agent.py
neutron/tests/unit/hacking/test_checks.py

Simple merge
index dc7c2f3f764ab438a8b9c54ac88d2a8d2434cb05,4ebb4d815250a83dece0d6766144e9850fc7005b..99305008d9829310b80df38bb74d913c3d6ea820
@@@ -113,23 -116,24 +123,29 @@@ class HackingTestCase(base.BaseTestCase
          self.assertEqual(
              0, len(list(checks.check_assert_called_once_with(pass_code,
                                              "neutron/tests/test_assert.py"))))
+         self.assertEqual(
+             1, len(list(checks.check_assert_called_once_with(fail_code3,
+                                             "neutron/tests/test_assert.py"))))
+         self.assertEqual(
+             0, len(list(checks.check_assert_called_once_with(pass_code2,
+                                             "neutron/tests/test_assert.py"))))
  
      def test_check_oslo_namespace_imports(self):
 -        def check(s, fail=True):
 -            func = checks.check_oslo_namespace_imports
 -            if fail:
 -                self.assertIsInstance(next(func(s)), tuple)
 -            else:
 -                with testtools.ExpectedException(StopIteration):
 -                    next(func(s))
 -
 -        check('from oslo_utils import importutils', fail=False)
 -        check('import oslo_messaging', fail=False)
 -        check('from oslo.utils import importutils')
 -        check('from oslo import messaging')
 -        check('import oslo.messaging')
 +        f = checks.check_oslo_namespace_imports
 +        self.assertLinePasses(f, 'from oslo_utils import importutils')
 +        self.assertLinePasses(f, 'import oslo_messaging')
 +        self.assertLineFails(f, 'from oslo.utils import importutils')
 +        self.assertLineFails(f, 'from oslo import messaging')
 +        self.assertLineFails(f, 'import oslo.messaging')
 +
 +    def test_check_python3_xrange(self):
 +        f = checks.check_python3_xrange
 +        self.assertLineFails(f, 'a = xrange(1000)')
 +        self.assertLineFails(f, 'b =xrange   (   42 )')
 +        self.assertLineFails(f, 'c = xrange(1, 10, 2)')
 +        self.assertLinePasses(f, 'd = range(1000)')
 +        self.assertLinePasses(f, 'e = six.moves.range(1337)')
 +
 +    def test_no_basestring(self):
 +        self.assertEqual(1,
 +            len(list(checks.check_no_basestring("isinstance(x, basestring)"))))