Skip to content

Commit

Permalink
Added ConfigTestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
rgerkin committed Nov 7, 2017
1 parent f5f24ba commit 347aaa7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion sciunit/unit_test/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import numpy as np
from IPython.display import display

import sciunit
from sciunit.utils import NotebookTools, import_all_modules


Expand Down Expand Up @@ -497,7 +498,6 @@ class CommandLineTestCase(unittest.TestCase):

def setUp(self):
from sciunit.__main__ import main
import sciunit

self.main = main
SCIDASH_HOME = os.path.dirname(os.path.dirname(sciunit.__path__[0]))
Expand Down Expand Up @@ -536,5 +536,22 @@ def test_example1(self):
from sciunit.tests import example


class ConfigTestCase(unittest.TestCase):
"""Unit tests for config files"""

def test_json_config(self):
config_path = os.path.join(sciunit.__path__[0],'config.json')
print(config_path)
self.assertTrue(os.path.isfile(config_path))
cmap_low = sciunit.config_get('cmap_low')
self.assertTrue(isinstance(cmap_low,int))
dummy = sciunit.config_get('dummy',37)
self.assertEqual(dummy,37)
try:
sciunit.config_get('dummy')
except sciunit.Error as e:
self.assertTrue('does not contain key' in str(e))


if __name__ == '__main__':
unittest.main()

0 comments on commit 347aaa7

Please sign in to comment.