old_contents: import unittest
  from valleybackups.config_handler import ConfigurationHandler
  import os
  
  
  class ValleybackupsTest(unittest.TestCase):
  
      def setUp(self):
          self.config = ConfigurationHandler("test.conf")
  
      def test_open_config_file(self):
          """Test filesystem access to configuration file"""
          config = ConfigurationHandler("test.conf")
          self.assertTrue(config)
  
      def test_set_valid_config(self):
          self.config.set_config('base', 'aws_account_id', '123123123')
  
  
      def test_set_invalid_config(self):
          with self.assertRaises(Exception):
              self.config.set_config('base', 'invalid_config', '123123123')
  
      def tearDown(self):
          os.remove(os.path.join(os.path.dirname(__file__), "test.conf"))
  
  if __name__ == '__main__':
      unittest.main()
  
new_contents: import unittest
  from valleybackups.config_handler import ConfigurationHandler
  import os
  import sys
  
  class ValleybackupsTest(unittest.TestCase):
  
      def setUp(self):
          self.config = ConfigurationHandler("test.conf")
  
      def test_open_config_file(self):
          """Test filesystem access to configuration file"""
          config = ConfigurationHandler("test.conf")
          self.assertTrue(config)
  
      def test_set_valid_config(self):
          self.config.set_config('base', 'aws_account_id', '123123123')
  
      def test_set_invalid_config(self):
          if sys.version_info[:2] == (2,6):
              self.assertRaises(Exception, self.config.set_config('base', 'invalid_config', '123123123'))
          else:
              with self.assertRaises(Exception):
                  self.config.set_config('base', 'invalid_config', '123123123')
  
      def tearDown(self):
          os.remove(os.path.join(os.path.dirname(__file__), "test.conf"))
  
  if __name__ == '__main__':
      unittest.main()
  
subject: Test with 2.6 compat