From 460bf70ea13cc64a2855c66ece08d49540f3b61d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mariana=20M=C4=83r=C4=83=C8=99oiu?= Date: Wed, 24 Aug 2011 21:15:03 +0300 Subject: [PATCH] ppf/new: Add config.py. Add skeleton functions and tests for config.py. --- ppf/new/config.py | 90 ++++++++++++++++++++++++++++++++++++ ppf/new/tests/test_config.py | 73 +++++++++++++++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 ppf/new/config.py create mode 100644 ppf/new/tests/test_config.py diff --git a/ppf/new/config.py b/ppf/new/config.py new file mode 100644 index 0000000..98a30fe --- /dev/null +++ b/ppf/new/config.py @@ -0,0 +1,90 @@ +""" +Configuration class for P2P logging information. + +2011, Mariana Marasoiu, mariana.marasoiu@gmail.com +""" + +import os +import os.path +import logging + +# +# Logging code heavily inspired by Logging HOWTO documentation: +# http://docs.python.org/dev/howto/logging.html#configuring-logging +# + +# Create logger; default logging level is DEBUG. +logger = logging.getLogger(__name__) +logger.setLevel(logging.DEBUG) + +# Create console handler and set level to ERROR. +ch = logging.StreamHandler() +ch.setLevel(logging.DEBUG) + +# Create formatter. +formatter = logging.Formatter('%(filename)s:%(lineno)s - %(levelname)s: %(message)s') + +# Add formatter to console handler. +ch.setFormatter(formatter) + +# Add console handler to logger. +logger.addHandler(ch) + + +class SwarmConfig(object): + def __init__(self): + pass + + def load(self, ini_file): + pass + + def store(self, ini_file): + pass + + def add(self, section, option, value): + pass + + def get(self, section): + pass + + def set(self, section, option, value): + pass + +class SessionConfig(object): + def __init__(self): + pass + + def load(self, ini_file): + pass + + def store(self, ini_file): + pass + + def add(self, section, option, value): + pass + + def get(self, section): + pass + + def set(self, section, option, value): + pass + +class AccessConfig(object): + def __init__(self): + pass + + def load(self, ini_file): + pass + + def store(self, ini_file): + pass + + def add(self, section, option, value): + pass + + def get(self, section): + pass + + def set(self, section, option, value): + pass + diff --git a/ppf/new/tests/test_config.py b/ppf/new/tests/test_config.py new file mode 100644 index 0000000..bc30a78 --- /dev/null +++ b/ppf/new/tests/test_config.py @@ -0,0 +1,73 @@ +""" +Test suite for config. Uses unittest module. + +2011, Mariana Marasoiu, mariana.marasoiu@gmail.com +""" + +import unittest +import os +import os.path +import shutil +import sys + +import config + +class SwarmConfigTest(object): + """ + Test suite for SwarmConfig class in config.py. + """ + def setUp(self) + pass + + def tearDown(self) + pass + + def test_add(self): + pass + + def test_get(self): + pass + + def test_other(self): + pass + +class SessionConfigTest(object): + """ + Test suite for AccessConfig class in config.py. + """ + def setUp(self) + pass + + def tearDown(self) + pass + + def test_add(self): + pass + + def test_get(self): + pass + + def test_other(self): + pass + +class AccessConfigTest(object): + """ + Test suite for AccessConfig class in config.py. + """ + def setUp(self) + pass + + def tearDown(self) + pass + + def test_add(self): + pass + + def test_get(self): + pass + + def test_other(self): + pass + +if __name__ == "__main__": + unittest.main() -- 2.20.1