Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Commit

Permalink
Issue #114 (GitHub): factored each test method out to respective sub-…
Browse files Browse the repository at this point in the history
…class
  • Loading branch information
Dzhoshkun Ismail Shakir committed Jun 1, 2018
1 parent fb7cce2 commit 308efb1
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions tests/niftynet_global_config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ def setUp(self):
def tearDown(self):
self.setUp()


class TestGlobalConfigSingleton(NiftyNetGlobalConfigTestBase):

@skipUnless('GLOBAL_CONFIG_TEST_gcs' in environ,
'set GLOBAL_CONFIG_TEST_gcs to run')
def test_global_config_singleton(self):
Expand All @@ -60,6 +63,9 @@ def test_global_config_singleton(self):
self.assertEqual(global_config_1, global_config_2)
self.assertTrue(global_config_1 is global_config_2)


class TestNonExistingConfigFileCreated(NiftyNetGlobalConfigTestBase):

@skipUnless('GLOBAL_CONFIG_TEST_necfc' in environ,
'set GLOBAL_CONFIG_TEST_necfc to run')
def test_non_existing_config_file_created(self):
Expand All @@ -69,6 +75,9 @@ def test_non_existing_config_file_created(self):
self.assertEqual(global_config.get_niftynet_config_folder(),
NiftyNetGlobalConfigTestBase.config_home)


class TestExistingConfigFileLoaded(NiftyNetGlobalConfigTestBase):

@skipUnless('GLOBAL_CONFIG_TEST_ecfl' in environ,
'set GLOBAL_CONFIG_TEST_ecfl to run')
def test_existing_config_file_loaded(self):
Expand All @@ -86,6 +95,9 @@ def test_existing_config_file_loaded(self):
custom_niftynet_home_abs)
NiftyNetGlobalConfigTestBase.remove_path(custom_niftynet_home_abs)


class TestIncorrectConfigFileBackedUp(NiftyNetGlobalConfigTestBase):

@skipUnless('GLOBAL_CONFIG_TEST_icfbu' in environ,
'set GLOBAL_CONFIG_TEST_icfbu to run')
def test_incorrect_config_file_backed_up(self):
Expand Down Expand Up @@ -114,6 +126,9 @@ def test_incorrect_config_file_backed_up(self):
# cleanup: remove backup file
NiftyNetGlobalConfigTestBase.remove_path(found_files[0])


class TestNonExistingNiftynetHomeCreated(NiftyNetGlobalConfigTestBase):

@skipUnless('GLOBAL_CONFIG_TEST_nenhc' in environ,
'set GLOBAL_CONFIG_TEST_nenhc to run')
def test_non_existing_niftynet_home_created(self):
Expand All @@ -135,6 +150,9 @@ def test_non_existing_niftynet_home_created(self):
for mod in NiftyNetGlobalConfigTestBase.default_config_opts['ext_mods']:
self.assertTrue(isfile(join(niftynet_ext, mod, '__init__.py')))


class TestExistingNiftynetHomeNotTouched(NiftyNetGlobalConfigTestBase):

@skipUnless('GLOBAL_CONFIG_TEST_enhnt' in environ,
'set GLOBAL_CONFIG_TEST_enhnt to run')
def test_existing_niftynet_home_not_touched(self):
Expand All @@ -153,27 +171,3 @@ def test_existing_niftynet_home_not_touched(self):

mtime_after = getmtime(niftynet_ext_init)
self.assertEqual(mtime_before, mtime_after)


class TestGlobalConfigSingleton(NiftyNetGlobalConfigTestBase):
pass


class TestNonExistingConfigFileCreated(NiftyNetGlobalConfigTestBase):
pass


class TestExistingConfigFileLoaded(NiftyNetGlobalConfigTestBase):
pass


class TestIncorrectConfigFileBackedUp(NiftyNetGlobalConfigTestBase):
pass


class TestNonExistingNiftynetHomeCreated(NiftyNetGlobalConfigTestBase):
pass


class TestExistingNiftynetHomeNotTouched(NiftyNetGlobalConfigTestBase):
pass

0 comments on commit 308efb1

Please sign in to comment.