From 9b337be1a6e392923509fa94435164b0da98960d Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Sat, 13 Apr 2019 18:26:34 +0200 Subject: Add test infrastructure --- tests/data/simple_config.yaml | 1 + tests/test_config.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/data/simple_config.yaml create mode 100644 tests/test_config.py (limited to 'tests') diff --git a/tests/data/simple_config.yaml b/tests/data/simple_config.yaml new file mode 100644 index 0000000..fa44e32 --- /dev/null +++ b/tests/data/simple_config.yaml @@ -0,0 +1 @@ +backend: none diff --git a/tests/test_config.py b/tests/test_config.py new file mode 100644 index 0000000..37f057e --- /dev/null +++ b/tests/test_config.py @@ -0,0 +1,22 @@ +import unittest + +from pyapd import config + + +class TestConfig(unittest.TestCase): + def setUp(self): + self.config = config.Config() + + def test_load_config_no_files(self): + self.config.load() + self.assertEqual(self.config.config_fn, 'pyapd_config.yaml') + self.assertIn('backend', self.config.data) + + def test_load_config_from_file(self): + self.config.load('tests/data/simple_config.yaml') + self.assertEqual( + self.config.config_fn, + 'tests/data/simple_config.yaml' + ) + self.assertIn('backend', self.config.data) + self.assertEqual(self.config.backend, 'none') -- cgit v1.2.3