Refactored assertScreenshot into a context manager
Refactored assertScreenshot into a context manager

This allows tests to be written in this style:

    def test_about(self):
        with self.compareScreenshot('body', 'about-us'):
            self.driver.get('%s/about/' % BASE_URL)

along with the traditional:

    def test_about(self):
        self.driver.get('%s/about/' % BASE_URL)
        self.assertScreenshot('body', 'about-us'):

The difference is that the former case can be significantly more
efficient when recording baseline screenshots as it doesn't require
loading the page simply to declare that an existing baseline will
not be overwritten


sri85/needle,jphalip/needle,bfirsh/needle