summaryrefslogtreecommitdiff
path: root/HACKING.rst
diff options
context:
space:
mode:
authorJoe Gordon <joe.gordon0@gmail.com>2013-07-08 11:38:33 +0200
committerJoe Gordon <joe.gordon0@gmail.com>2013-07-08 18:31:03 +0100
commit1b3cd6ff9e9c77dbb267d293877c0c55c3a0382e (patch)
treebd448f7f0689940548f0e67f4f72712b9ceac87d /HACKING.rst
parent5c8616d03ecc271a79c6c41ce54bfbf719bb940f (diff)
downloadpython-novaclient-1b3cd6ff9e9c77dbb267d293877c0c55c3a0382e.tar.gz
Clean up and make HACKING.rst point to openstack-dev/hacking
Instead of having a full local copy of HACKING Reference the OpenStack hacking guide (openstack-dev/hacking) and remove duplicate sections. Change-Id: Iaabc27c42d74b7441c17e63db15724f64114620b
Diffstat (limited to 'HACKING.rst')
-rw-r--r--HACKING.rst59
1 files changed, 59 insertions, 0 deletions
diff --git a/HACKING.rst b/HACKING.rst
new file mode 100644
index 00000000..ac363673
--- /dev/null
+++ b/HACKING.rst
@@ -0,0 +1,59 @@
+Nova Client Style Commandments
+==============================
+
+- Step 1: Read the OpenStack Style Commandments
+ https://github.com/openstack-dev/hacking/blob/master/HACKING.rst
+- 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