Skip to content

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 and mock. Look at written tests to see how it works.
    • Enter the main directory with a bash or terminal, enter into your command line nosetests and press ENTER. It will find and check all tests and assertions you add in tests automagically. At least if the test functions start with test_.
    • 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.
  • 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.
Clone this wiki locally