File: HACKING.rst

package info (click to toggle)
python-novaclient 2%3A17.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 2,708 kB
  • sloc: python: 23,583; makefile: 22; sh: 21
file content (41 lines) | stat: -rw-r--r-- 1,153 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
-------------

- 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 stestr. 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
stestr itself.