Use timeutils.utcnow() throughout the code

timeutils.utcnow() should be used instead of direct calls to
datetime.datetime.utcnow() to make it easy to override its return
value in tests.

Add a hacking rule to prevent regressions.

Fixes bug 1200141.

Change-Id: I170dbd7c9093bd627e2a0d5984b7ad1bf105c8d5
This commit is contained in:
Roman Podolyaka 2013-07-11 11:52:52 +03:00
parent 0ef3a5db57
commit ae7dcbc843
1 changed files with 2 additions and 0 deletions

View File

@ -11,6 +11,8 @@ Nova Specific Commandments
- ``nova.db`` imports are not allowed in ``nova/virt/*``
- [N309] no db session in public API methods (disabled)
This enforces a guideline defined in ``nova.openstack.common.db.sqlalchemy.session``
- [N310] timeutils.utcnow() wrapper must be used instead of direct calls to
datetime.datetime.utcnow() to make it easy to override its return value in tests
Creating Unit Tests
-------------------