def tearDown(self):
     """Tear down the test fixture
     """
     # Some tests may leave pl 'configured'
     plot._SETUP_DONE = False  # pylint: disable=protected-access
     log.reset_instance()
     conf.reset_instance()
Beispiel #2
0
 def tearDown(self):
     """Tear down the test fixture
     """
     # Some tests may leave pl 'configured'
     plot._SETUP_DONE = False  # pylint: disable=protected-access
     log.reset_instance()
     conf.reset_instance()
    def setUp(self):
        """Set up the test
        """
        self.log_stream = io.StringIO()
        Logger.CONSOLE_STREAM_HANDLER = logging.StreamHandler(self.log_stream)

        log.reset_instance()
        conf.reset_instance()
Beispiel #4
0
 def test_empty_conf(self):
     """Test empty config throws Exception
     """
     conf.reset_instance()
     self.assertRaises(KeyError, lambda: conf["a"])
     # Equivalent, but just to be sure it still works through the delegated
     # singleton
     self.assertRaises(KeyError, conf.__getitem__, "a")
    def setUp(self):
        """Set up the test
        """
        self.log_stream = io.StringIO()
        Logger.CONSOLE_STREAM_HANDLER = logging.StreamHandler(self.log_stream)

        log.reset_instance()
        conf.reset_instance()
 def test_empty_conf(self):
     """Test empty config throws Exception
     """
     conf.reset_instance()
     self.assertRaises(KeyError, lambda: conf['a'])
     # Equivalent, but just to be sure it still works through the delegated
     # singleton
     self.assertRaises(KeyError, conf.__getitem__, 'a')
Beispiel #7
0
 def test_save_no_config(self):
     """Test saving uninitialized config
     """
     conf["a"] = 12
     with tempfile.NamedTemporaryFile() as temp:
         conf.save(temp.name)
         conf.reset_instance()
         self.assertNotIn("a", conf)
         conf.load(temp.name)
         self.assertIn("a", conf)
         self.assertEqual(int(conf["a"]), 12)
 def test_save_no_config(self):
     """Test saving uninitialized config
     """
     conf['a'] = 12
     with tempfile.NamedTemporaryFile() as temp:
         conf.save(temp.name)
         conf.reset_instance()
         self.assertNotIn('a', conf)
         conf.load(temp.name)
         self.assertIn('a', conf)
         self.assertEqual(int(conf['a']), 12)
Beispiel #9
0
    def test_save_load_config(self):
        """Test saving and reloading conf
        """
        conf.load(self.filename)

        filename = tempfile.mkstemp()[1]
        conf.save(filename)

        # Destroy configuration
        conf.reset_instance()
        self.assertRaises(KeyError, lambda: conf["section_1.a"])

        conf.load(filename)
        a_conf = conf["section_1.a"]
        self.assertEqual(a_conf, "12")
        b_conf = conf["section_1.b"]
        self.assertEqual(b_conf, "13")
        c_conf = conf["section_2.c"]
        self.assertEqual(c_conf, "True")

        self.assertTrue(os.path.isfile(filename))
        # Clean up
        os.remove(filename)
    def test_save_load_config(self):
        """Test saving and reloading conf
        """
        conf.load(self.filename)

        filename = tempfile.mkstemp()[1]
        conf.save(filename)

        # Destroy configuration
        conf.reset_instance()
        self.assertRaises(KeyError, lambda: conf['section_1.a'])

        conf.load(filename)
        a_conf = conf['section_1.a']
        self.assertEqual(a_conf, '12')
        b_conf = conf['section_1.b']
        self.assertEqual(b_conf, '13')
        c_conf = conf['section_2.c']
        self.assertEqual(c_conf, 'True')

        self.assertTrue(os.path.isfile(filename))
        # Clean up
        os.remove(filename)
Beispiel #11
0
 def test_empty_initialized_conf(self):
     """Test empty config throws Exception even after initialization
     """
     conf.reset_instance()
     conf.initialize()
     self.assertRaises(KeyError, lambda: conf["a"])
Beispiel #12
0
 def tearDown(self):
     """Tear down the test fixture
     """
     conf.reset_instance()
     os.remove(self.filename)
Beispiel #13
0
 def tearDown(self):
     """Tear down the test fixture
     """
     conf.reset_instance()
 def test_empty_initialized_conf(self):
     """Test empty config throws Exception even after initialization
     """
     conf.reset_instance()
     conf.initialize()
     self.assertRaises(KeyError, lambda: conf['a'])
 def tearDown(self):
     """Tear down the test fixture
     """
     conf.reset_instance()
     os.remove(self.filename)
 def tearDown(self):
     """Tear down the test fixture
     """
     conf.reset_instance()