Introduction to patching in Python

If you want to use it in a version earlier than python3.3, you need yo install it:

sudo pip install mock

Simple example

Code to test:

import time
def do_something():
    if time.sleep(100):
        print 'ok'
        print 'ko'

Actual test:

from mock import patch
def test_do_something1(mock_sleep):
    mock_sleep.return_value = True

def test_do_something2(mock_sleep):
    mock_sleep.return_value = False


>>> test_do_something1()
>>> test_do_something2()


Port in use

To find which application is using a specific port, do:

lsof -i <port-number>

Or list ports with associated processes in use:

netstat -putln


The configuration and especially right permissions will be done in /etc/rsyslog.conf

Bitmask is going to be used so use this doc

It will be taken into account for the new log files only when we reload rsylog with this commend:

/etc/init.d/rsyslog reload

The old files are still on the old configuration. So, you need to change the right access directly for them with chown and chmod.

Example for vagrant user:

[email protected]:/var/log/openerp# chown vagrant:vagrant /var/log/openerp/ -R
[email protected]:/var/log/openerp# chmod a+r /var/log/openerp/ -R


Agile testing

The best book I ever read about testing and best practices in an Agile project is: Agile Testing: A Practical Guide for Testers and Agile Teams (Addison-Wesley Signature)

The main idea of Agility is constantly giving and receiving feedback in order to keep improving the process and the output of the project.

Testing quadrant