# HG changeset patch # User Jeff Hammel # Date 1332806077 25200 # Node ID c516ab813079395a4264bd20d535aa3a6335bc7a # Parent c6d966431498491ea757597c2724d41f30462d75 begin stubbing serialization/deserialization diff -r c6d966431498 -r c516ab813079 configuration/config.py --- a/configuration/config.py Mon Mar 26 16:40:35 2012 -0700 +++ b/configuration/config.py Mon Mar 26 16:54:37 2012 -0700 @@ -251,3 +251,21 @@ # return parsed arguments return options, args + + ### serialization/deserialization + + def configuration_provider(self, format): + """configuration provider guess for a given filename""" + for provider in self.configuration_providers: + if format in provider.extensions: + return provider + + def serialize(self, filename, format=None): + """serialize configuration to a file""" + + def deserialize(self, filename, format=None): + """load configuration from a file""" + + extension = os.path.splitext(filename)[-1] + if not extension: + return None diff -r c6d966431498 -r c516ab813079 tests/unit.py --- a/tests/unit.py Mon Mar 26 16:40:35 2012 -0700 +++ b/tests/unit.py Mon Mar 26 16:54:37 2012 -0700 @@ -16,6 +16,8 @@ class ConfigurationUnitTest(unittest.TestCase): def test_cli(self): + """test command line interface""" + example = ExampleConfiguration() # parse command line arguments @@ -32,6 +34,9 @@ self.assertEqual(example.config['activeTests'], ['ts']) self.assertEqual(example.config['browser_path'], '/home/jhammel/bin/firefox') + def test_configuration_providers(self): + """test file-based configuration providers""" + if __name__ == '__main__': unittest.main()