Exemple #1
0
 def test_logger(self):
     test_log_dir = utils.get_home_directory() + "logs/"
     log.setup_logger(name="test")
     test_log = log.get_logger("TEST")
     self.assertEqual("TEST", test_log.name)
     self.assertEqual(test_log.level, 0)
     os.unlink(test_log_dir + "test.log")
Exemple #2
0
    def test_logger(self):
        test_log_dir = utils.get_home_directory() + "logs/"

        try:
            # NOTE(jk0): If the configuration file doesn't exist, the config
            # class will generate it and raise a SystemExit.
            test_log = logger.get_logger("TEST")
        except SystemExit:
            test_log = logger.get_logger("TEST")

        self.assertEqual("TEST", test_log.name)
        self.assertEqual(test_log.level, 0)

        os.unlink(test_log_dir + "test.log")
Exemple #3
0
    def test_logger(self):
        test_log_dir = utils.get_home_directory() + "logs/"

        try:
            # NOTE(jk0): If the configuration file doesn't exist, the config
            # class will generate it and raise a SystemExit.
            test_log = logger.get_logger("TEST")
        except SystemExit:
            test_log = logger.get_logger("TEST")

        self.assertEqual("TEST", test_log.name)
        self.assertEqual(test_log.level, 0)

        os.unlink(test_log_dir + "test.log")
Exemple #4
0
 def setUp(self):
     home_dir = utils.get_home_directory()
     self.config = config.Config(home_dir + "pyhole.conf", "Pyhole")
Exemple #5
0
 def test_get_conf_file_path(self):
     conf_file_path = utils.get_conf_file_path()
     actual_conf_file_path = utils.get_home_directory() + "pyhole.conf"
     self.assertEqual(conf_file_path, actual_conf_file_path)
Exemple #6
0
 def test_get_directory(self):
     new_dir = utils.get_home_directory() + "test_dir"
     self.assertFalse(os.path.exists(new_dir))
     utils.get_directory("test_dir")
     self.assertTrue(os.path.exists(new_dir))
     os.rmdir(new_dir)
Exemple #7
0
 def test_get_home_directory(self):
     self.assertTrue(utils.get_home_directory().endswith("/.pyhole/"))
Exemple #8
0
 def setUp(self):
     utils.write_file("tests", "pyhole_test_file", "foo")
     self.new_file = utils.get_home_directory() + "tests/pyhole_test_file"
     self.cpid = os.getpid()
Exemple #9
0
 def test_get_conf_file_path(self):
     conf_file_path = utils.get_conf_file_path()
     actual_conf_file_path = utils.get_home_directory() + "pyhole.conf"
     self.assertEqual(conf_file_path, actual_conf_file_path)
Exemple #10
0
 def test_get_directory(self):
     new_dir = utils.get_home_directory() + "test_dir"
     self.assertFalse(os.path.exists(new_dir))
     utils.get_directory("test_dir")
     self.assertTrue(os.path.exists(new_dir))
     os.rmdir(new_dir)
Exemple #11
0
 def test_get_home_directory(self):
     self.assertTrue(utils.get_home_directory().endswith("/.pyhole/"))
Exemple #12
0
 def setUp(self):
     utils.write_file("tests", "pyhole_test_file", "foo")
     self.new_file = utils.get_home_directory() + "tests/pyhole_test_file"
     self.cpid = os.getpid()
Exemple #13
0
 def setUp(self):
     home_dir = utils.get_home_directory()
     self.config = config.Config(home_dir + "pyhole.conf", "Pyhole")
Exemple #14
0
 def test_get_directory(self):
     new_dir = utils.get_home_directory() + "test_dir/"
     actual_dir = utils.get_directory("test_dir")
     self.assertEqual(new_dir, actual_dir)
     os.rmdir(new_dir)