Unit Test Your Dev Environment

February 13th, 2009
[ Geek ]

This is likely one of those parties I just happen to be late showing up for, move along if this sounds like old news. I had an issue this weekend related to having the wrong version of a framework running in one of my development environments. It eventually became clear that was the issue as the bug only existed on one machine, worked fine on others.

This isn’t the first time I’ve been bitten by this pattern of bug and it won’t be the last. My guess is you’d be hard pressed to find a developer who hasn’t ran into this. In an attempt to put this headache to bed once and for all, I added a test to the unit test suite that scrapes the version of all the required frameworks and validates they’re the ones expected. Hopefully I’ll spot this issue quicker next time it hits.

(trying syntaxhighlighter for the first time)

        # check elixir
        import elixir
        version = elixir.__version__
        self.assertEqual(self._elixir_ver, version,
                "Incorrect Elixir version, expected '%s', local is '%s'" %
                (self._elixir_ver, version))