Unittests Mocking and Coverage

July 24, 2013 - 2 minute read -
unittests mock coverage

Commits

Things done

Last two days were almost devoted to unittests. I learnt how to use pytest-cov. The command issued by me is

py.test --cov-report html --cov [file/files to be checked] [file having unittests]
py.test --cov-report html --cov server.py test_server.py
	

I also learnt how to make mock classes and functions. I also learnt about monkeypatch techniques. Some links about these are:

I have achieved 100% coverage for server.py and connection

Next..

  • Write Makefile for pylint and pep8
  • 100% coverage for rest files
  • Integration tests

Comments Section

Feel free to comment on the post but keep it clean and on topic.

blog comments powered by Disqus