Monthly Archives: August 2011

Setting up debugging for Google AppEngine projects in Eclipse

When I made the move from Windows to OSX and Python development one of the things I wanted to experiment with has been Google’s AppEngine. I installed the SDK and setup the plugin for Eclipse but ran into a few issues I wanted to make note of since I think other could probably benefit from it as well. I’ll mention I’m on OSX 10.6.8 using Eclipse for Java Version Helios SR 2.
Continue reading Setting up debugging for Google AppEngine projects in Eclipse

Publishing Python unit test results in Jenkins

When I switched to developing on an OS stack one of the first things I look for was a $g(Continuous Integration server) and settled on Hudson which, after some tumult with surrounding Oracle’s acquisition of Sun, was forked into Jenkins. Getting jenkins setup couldn’t be easier and the web UI is comprehensive and full of options.

My day-to-day development is in Python and I’ve written a bunch of tests based on the core unittest module though it doesn’t natively produce results that can be consumed by Jenkins. To that end, I searched around and found the necessary pieces which I wanted to capture.

First, you need to install the unittest-xml-reporting package which is described as:

PyUnit-based test runner with JUnit like XML reporting.

sudo easy_install unittest-xml-reporting

Once installed you need to add the following to your unittests so they will produce the necessary XML result output:

import xmlrunner
...
if __name__ == '__main__':
    unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'))

Next, in Jenkins click the configure link for your project and check the Publish JUnit test result report and set the path to the output location for the unit tests. In my case the full path to the XML output is /.hudson/jobs/publishing/workspace/trunk/test/test-reports. In Jenkins the path to use for publishing is **/trunk/test/test-reports/*.xml

Jenkins JUnit publisher settings

This will also add a chart to the project page in Jenkins:

image

OAuth 2.0 reference for Facebook development

As I mentioned, I’m working on Facebook support which involves the transition to the new $g(OAuth 2) authentication. What I’m going to do here, for myself if no one else, is keep a list of links I’ve found related to the topic. Without further adieu:

Of course, feel free to leave a comment with anything useful you’ve found.

Improving the Facebook Python SDK GraphAPI.request method

While working on Facebook functionality using Python I ran into a few cases where the GraphAPI.request method caused Facebook to choke on parameters with a value of None. Thus here’s a simple override to allow for None parameters which subsequently get stripped out.

def request(self, path, args=None, post_args=None):
    ''' Improves handling for post_args where any arg with a None value gets removed to avoid FB API errors.
        Allows for methods that accept all possible Facebook parameters and only passes those that are specified.
    '''
    if post_args:
        d = {}
        for a in post_args:
            if post_args[a] != None:
                d.setdefault(a, post_args[a])
        post_args = d
    return GraphAPI.request(self, path, args, post_args)

I’ve created a descendant class I call GraphAPIEx where this above method appears.

Removing rounded corners on jQueryUI elements

I had this question today and it turns out the answer is pretty simple

  1. First, it’s important to note that as of this writing IE 8 (what I tested) doesn’t render rounded corners as implemented in jQueryUI v1.8.14 though I understand there is a plugin that enables that feature.
  2. To remove rounded corners on all elements of jQueryUI (for Chrome, FF and Safari) you can include the following in your own CSS:
    .ui-corner-all { border-radius: 0px; -moz-border-radius-bottomright: 0px; -moz-border-radius-bottomleft: 0px; -moz-border-radius-topright: 0px; -moz-border-radius-topleft: 0px;}
    }

Now, credit where credit is due.