python-novaclient/HACKING.rst
Takashi NATSUME 561b35a8a8 Update URLs in docs, comments and setup.cfg
Some URLs are broken, so fix them.
The other URLs are redirect to new URLs,
so replace them with new ones.

Change-Id: Ida2fd70ad0d7b029fadfe91be14d7180b9b5b8d1
Closes-Bug: #1707104
2017-07-28 12:14:12 +09:00

60 lines
1.4 KiB
ReStructuredText

Nova Client Style Commandments
==============================
- Step 1: Read the OpenStack Style Commandments
https://docs.openstack.org/hacking/latest
- Step 2: Read on
Nova Client Specific Commandments
---------------------------------
None so far
Text encoding
-------------
- All text within python code should be of type 'unicode'.
WRONG:
>>> s = 'foo'
>>> s
'foo'
>>> type(s)
<type 'str'>
RIGHT:
>>> u = u'foo'
>>> u
u'foo'
>>> type(u)
<type 'unicode'>
- Transitions between internal unicode and external strings should always
be immediately and explicitly encoded or decoded.
- All external text that is not explicitly encoded (database storage,
commandline arguments, etc.) should be presumed to be encoded as utf-8.
WRONG:
mystring = infile.readline()
myreturnstring = do_some_magic_with(mystring)
outfile.write(myreturnstring)
RIGHT:
mystring = infile.readline()
mytext = s.decode('utf-8')
returntext = do_some_magic_with(mytext)
returnstring = returntext.encode('utf-8')
outfile.write(returnstring)
Running Tests
-------------
The testing system is based on a combination of tox and testr. If you just
want to run the whole suite, run `tox` and all will be fine. However, if
you'd like to dig in a bit more, you might want to learn some things about
testr itself. A basic walkthrough for OpenStack can be found at
http://wiki.openstack.org/testr