zun/HACKING.rst
Feng Shengqin 2a4b99bf89 Add a testcase to test whether using log.warn
Change-Id: I38ff5865991ceab80f98b4c10c40cffaae5a6946
2016-12-21 22:34:31 +08:00

1.0 KiB

Zun Style Commandments

Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/

Zun Specific Commandments

  • [Z302] Change assertEqual(A is not None) by optimal assert like assertIsNotNone(A).
  • [Z310] timeutils.utcnow() wrapper must be used instead of direct calls to datetime.datetime.utcnow() to make it easy to override its return value.
  • [Z316] Change assertTrue(isinstance(A, B)) by optimal assert like assertIsInstance(A, B).
  • [Z318] Change assertEqual(A, None) or assertEqual(None, A) by optimal assert like assertIsNone(A)
  • [Z322] Method's default argument shouldn't be mutable.
  • [Z323] Change assertEqual(True, A) or assertEqual(False, A) by optimal assert like assertTrue(A) or assertFalse(A)
  • [Z336] Must use a dict comprehension instead of a dict constructor with a sequence of key-value pairs.
  • [Z338] Use assertIn/NotIn(A, B) rather than assertEqual(A in B, True/False).
  • [Z339] Don't use xrange()
  • [Z352] LOG.warn is deprecated. Enforce use of LOG.warning.