Correcting lots of stuff

July 20, 2013 - 3 minute read -
python gsoc

What was Wrong

While writing unittests I went off-track. Thankfully, mithro guided me at correct time. Two major wrong things I was doing were:

  1. For testing purposes, to each and every function in my code I was adding input validation statements, so that I did not get any TypeError or ValueError while running it. Instead of doing this, I should have made exception handlers. So my last few commits were not useful at all and I had to remove them.
  2. I was using setters and getters in my code. I had added them to give extra abstraction to the user. However, I learnt that in python these are seldom used. So, I had to remove these lines from the code.
These things were the reason I delayed writing this blog post.

Commits:

A rather long list of commits:

Exception Handling

From above experience I learnt that I had to put exception handlers in my code. I had very little knowledge of exception handlers and absolutely no experience.

Some good links that I found were very useful in the field of exception handling and testing:

After spending lots of time on reading exception handling in python, I made a few changes to the code, where I defined some custom Exceptions like PathError: Raised when a wrong path is specified to the run the gst-switch-srv process. Another one is ServerProcessError: Raised when something wrong happens with the process running like a OSError indicating some internal fault.

Things to do..

Add exception handling for all modules and write py.test testing modules for testing them

Comments Section

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

blog comments powered by Disqus