#Django #TransactionTestCase with REUSE_DB=1 of #django-nose

Lately, I found out that Django’s TransactionTestCase leaves test data in database after the test case is executed. It’s not until the next execution of _pre_setup method of a TransactionTestCase instance that the database is flushed. This is troublesome when tests are run with Django Nose’s test runner with REUSE_DB =1. An easy fix to this is to customize the TransactionTestCase so that it deletes the test data on exit. I wrote a simple wrapper around Django’s TransactionTestCase and extend it to write other transaction test cases. ...

September 8, 2012 · 1 min · Ratnadeep Debnath

App specific logging in Transifex

Yesterday, I was working on adding app specific loggers in Transifex. By app specific logger I mean a logger which shows the app name which generated the log. As of now, the logs in Transifex look something like this: [sourcecode language=”python”] 2012-06-29 13:01:43,300 tx DEBUG Saved: Project Avant Window Navigator 2012-06-29 13:01:43,312 tx DEBUG Saved: Project Switchdesk 2012-06-29 13:01:43,324 tx DEBUG Saved: Project Usermode 2012-06-29 13:01:43,342 tx DEBUG Saved: Project desktop-effects 2012-06-29 13:01:43,349 tx DEBUG Saved: Project im-chooser 2012-06-29 13:01:43,355 tx DEBUG Saved: Project Test Project 2012-06-29 13:01:43,364 tx DEBUG Saved: Project Test Private Project 2012-06-29 13:01:45,704 tx DEBUG Saved: Project Test Project 2012-06-29 13:01:45,717 tx DEBUG Saved: Project Test Private Project 2012-06-29 13:01:45,731 tx DEBUG Resource Resource1: New ResourcePriority created. [/sourcecode] ...

June 30, 2012 · 4 min · Ratnadeep Debnath

FUDCON KL Day 3

The 3rd day of FUDCON KL started a bit sluggishly for me. May be because of brainstorming and hacking till late night. We (Kushal, Soumya and me) decided to work on a new app to display system logs in a user friendly manner. We named the application Tower log tower, in short, tlogt, after Twin towers of Kuala Lumpur During the first few hours of the day, we went to visit some tourist spots in Kuala Lumpur: Aquaria and Petronas towers. After we returned, we settled down for the on going talks. Amidst of various talks on the 3rd day of FUDCON, I was sometimes in listening mode, but for most time I was in coding mode. We decided to try something different in TlogT. The UI would be rendered by a Django daemon with all the WOW factor of HTML, CSS and JS. I was to code the Django server code, while Kushal and Soumya were working on writing the parsers for extracting the logs for various processes. In a few hours, we had a decent Django based functional desktop app ready. Although, quite some work remains to be done on the UI part. ...

June 2, 2012 · 2 min · Ratnadeep Debnath

Me & FUDCON India 2011

I arrived in Pune for FUDCON on November 2, 2011. On November 3, 2011, I had an opportunity to visit the Red Hat office in the city and hang around with Fedora community members. I learnt more about the mechanism and importance of localization from Runa Bhattacharjee. In my free time, I also helped with some FUDCON related work. I was able to meet Jared Smith, Joerg Simon and Robert Scheck for the first time in my life, talk with them. I couldn’t ask for anything better. ...

November 7, 2011 · 7 min · Ratnadeep Debnath

Start testing Transifex

How do you setup Transifex? Here is all you need to know to setup Transifex: http://help.transifex.net/server/install.html http://fosswithme.wordpress.com/2011/10/20/setup-transifex-in-virtualenv/ is another good write-up on how to setup and run Transifex in virtualenv. So, I’d be building on top of that to show you how to start testing Transifex using django-nose. What packages will you need? django-nose, nose, nose-exclude, coverage You can install the above packages using pip install <package_name> Configure Transifex settings to enable django-nose Test Runner ...

November 1, 2011 · 2 min · Ratnadeep Debnath

Add plug-n-play functionality to your Django project using Django-addons

What is Django-addons? A Django app used to add true plug-n-play functionality to your own Django applications and projects. Django-addons is brought to you by Indifex, the company behind Transifex. Django-addons is a bunch of code that makes writing addon/plugins for your Django project much easier. Add django-addons to your Django project and you can drop all the addons to ‘/addons’ directory. How to install Django-addons? You can install the latest version of django-addons running pip install django-addons or easy_install django-addons ...

October 19, 2011 · 1 min · Ratnadeep Debnath

Transifex implements related tag cloud

Lately, I have been working on a bunch of exciting new stuffs for Transifex. I have worked on a tag-cloud implementation which not only shows the popular tags, but also shows tags related to a tag selected by the user. It is pretty useful. It directs the user to select more relevant tags. The tag cloud is refreshed each time the user makes a selection to show the related tags. ...

October 10, 2011 · 2 min · Ratnadeep Debnath

A brief introduction to coverage.py

Coverage.py is a tool for measuring code coverage of Python programs. It monitors your program, noting which parts of the code have been executed, then analyzes the source to identify code that could have been executed but was not. Coverage measurement is typically used to gauge the effectiveness of tests. It can show which parts of your code are being exercised by tests, and which are not. Getting started: Install coverage: pip install coverage easy_install coverage Use coverage to run your program and gather data: $ coverage run my_program.py arg1 arg2 blah blah ..your program’s output.. blah blah ...

September 22, 2011 · 2 min · Ratnadeep Debnath

Testing coverage of your Django code

Just writing tests for your Django codebase is not enough. You need to check how much of the code is covered in your tests. For this, there are some tools available. Again, it is not just the number of lines of code tested that matters. What matters is “Are these lines important?”. Well, for this, we have to use our head. covergae is a tool for checking test coverage of python applications. django-test-coverage was built on top of coverage.py to meet requirements of django tests. ...

June 12, 2011 · 2 min · Ratnadeep Debnath

Contributing to transifex

For some time, I have been hanging around with django. I got some cool video tutorials on the web on django. They helped me a lot to start coding in django. At the same time, I was also going through the Transifex source code. After some time, I browsed through the tickets in trac.transifex.org and started with fixing ticket #679. I had to go through javascript, jquery, html in addition to write the patch for #679. I also wrote a custom pagination plugin for dataTables pagination for fixing the issue mentioned in ticket #679. I submitted the patch upstream for review. I hope it will be accepted. ...

February 21, 2011 · 2 min · Ratnadeep Debnath