magnum/HACKING.rst
wangqun 8c7925a018 timeutils.utcnow should be used instead of datetime.datetime.utcnow
Developer should use timeutils.utcnow to replace the
datetime.datetime.utcnow.

Change-Id: Ifaca72e286a805632cd17406464175ba6819a9b0
Closes-Bug: #1513308
2015-11-05 13:04:00 +00:00

1.0 KiB

Magnum Style Commandments

Magnum Specific Commandments

  • [M301] policy.enforce_wsgi decorator must be the first decorator on a method.
  • [M310] timeutils.utcnow() wrapper must be used instead of direct calls to datetime.datetime.utcnow() to make it easy to override its return value.
  • [M318] Change assertEqual(A, None) or assertEqual(None, A) by optimal assert like assertIsNone(A)
  • [M322] Method's default argument shouldn't be mutable.
  • [M323] Change assertEqual(True, A) or assertEqual(False, A) by optimal assert like assertTrue(A) or assertFalse(A)
  • [M302] Change assertEqual(A is not None) by optimal assert like assertIsNotNone(A).
  • [M316] Change assertTrue(isinstance(A, B)) by optimal assert like assertIsInstance(A, B).
  • [M334] Change assertTrue/False(A in/not in B, message) to the more specific assertIn/NotIn(A, B, message)