-
Notifications
You must be signed in to change notification settings - Fork 0
Developer Guidelines
Bijan Chokoufe Nejad edited this page Aug 5, 2014
·
3 revisions
- ALWAYS RUN nosetests before committing any code! It is not optional but mandatory!
- 2 spaces for indentation. No tabs. No whitespace at the end of a line
- Surround operators like
+
,-
,=
, .. with a single space - Never write more than 80 characters in a line. Try to avoid
&
by abusing that python will look in the next line after,
- Use
git add -p
to add content. It will warn you of trailing spaces and you reflect about your work - Write a test for every function you write
- Our tools are
nose
andmock
. Look at written tests to see how it works. - Enter the main directory with a
bash
orterminal
, enter into your command linenosetests
and pressENTER
. It will find and check all tests and assertions you add intests
automagically. At least if the test functions start withtest_
. - Run
nosetests -s
to see stdout that is otherwise captured. It is not necessary to add a main in the test module. - Select a test with
nosetests tests/test_whatiwant.py
to concentrate on this specific file in the output and messages.
- Our tools are
- Add at least a line of docstring with
"""some meaningful words"""
to each function that is more complex than__str__
or__init__
- Every module has its own file. Use a lot of modules to improve parallel programming and overall structure
- Do not add a
main
in a module. You can test and try out as much as you like in the corresponding test and improve thereby even the stability of the code, especially you protect your work against breakage due to changes in other modules - Namespace:
ez_modulename
,tests/test_modulename
- Have a look at the references page for more information on the web.