Added unittest for utils.py

Now a basic unittest for utils.py
is available under tests/test_utils.py.
While writing unittest two bugs were encountered
and fixed also on this commit.

tox.ini also has been modified to be able to use
runtests.py

Change-Id: Ieecd9549f358566ba5d4c7fcf7ad5780b9311dcd