Files
d4ed9ed93f91e2ffa43b563abdc5a3b90ab358a1
nova /HACKING.rst

151 lines
7.6 KiB
ReStructuredText
Raw Normal View History

2010年05月27日 23:05:26 -07:00
Nova Style Commandments
=======================
https://docs.openstack.org/hacking/latest/
2010年05月27日 23:05:26 -07:00
---------------------------
2011年07月29日 12:49:48 -04:00
datetime.datetime.utcnow() to make it easy to override its return value in tests
Code that needs to be shared between virt drivers should be moved
into a common module
- [N312] using config vars from other virt drivers forbidden
Config parameters that need to be shared between virt drivers
should be moved into a common module
Config parameter help strings should have a capitalized first letter
assertIsInstance(A, B).
- [N317] Change assertEqual(type(A), B) by optimal assert like
assertIsInstance(A, B)
self.flags(option=value) instead.
- [N327] Do not use xrange(). xrange() is not compatible with Python 3. Use range() or six.moves.range() instead.
assertIn/NotIn(A, B, message)
assertEqual(A in B, False) or assertEqual(False, A in B) to the more specific
assertIn/NotIn(A, B)
- [N345] Python 3: do not use dict.iterkeys.
- [N346] Python 3: do not use dict.itervalues.
- [N356] Enforce use of assertIs/assertIsNot
generate UUID instead of uuid4().
assertNotRegexpMatches
not "from nova.privsep import path". This ensures callers know that the method they're
calling is using priviledge escalation.
-------------------
For every new feature, unit tests should be created that both test and
(implicitly) document the usage of said feature. If submitting a patch for a
bug that had no unit test, a new passing unit test should be added. If a
submitted bug fix does have a unit test, be sure to add a new one that fails
without the patch and passes with the patch.
For more information on creating unit tests and utilizing the testing
Running Tests
-------------
create virtual environments, populate them with dependencies and run all of
stestr arguments that are needed to tox. For example, you can run:
``tox -- --analyze-isolation`` to cause tox to tell stestr to add
the class name containing the tests as an extra ``tox`` argument;
e.g. ``tox -- TestWSGIServer`` (note the double-hypen) will test all
``-- TestWSGIServer|TestWSGIServerWithSSL`` would run tests from both
classes.
you have created, or it is possible that you have all of the dependencies
command directly. Running ``stestr run`` will run the entire test suite.
``stestr run --concurrency=1`` will run tests serially (by default, stestr runs
tests in parallel). More information about stestr can be found at:
http://stestr.readthedocs.io/
log at ``DEBUG`` level by exporting the ``OS_DEBUG`` environment
variable to ``True``.
-------------
which will cause a virtualenv with all of the needed dependencies to be
created and then inside of the virtualenv, the docs will be created and
put into doc/build/html.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If you'd like a PDF of the documentation, you'll need LaTeX and ImageMagick
installed, and additionally some fonts. On Ubuntu systems, you can get what you
need with::
Then you can use the ``build_latex_pdf.sh`` script in tools/ to take care
of both the sphinx latex generation and the latex compilation. For example::
output pdf to Nova.pdf in that directory.