Skip to content

Commit

Permalink
Merge pull request #47 from HPCNow/main
Browse files Browse the repository at this point in the history
Enabled all current tests in github actions
  • Loading branch information
victormachadoperez authored May 17, 2024
2 parents 0ffc44c + c7b4ae3 commit 71eea7f
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def test_set_shared_froster_shared_config_exist(self, mock_print, mock_input_con
self.assertTrue(os.path.exists(archive_json_file_shared))


# @patch('builtins.print')
@patch('builtins.print')
class TestConfigNIH(unittest.TestCase):

# Method executed before every test
Expand Down Expand Up @@ -541,7 +541,6 @@ def test_set_nih(self, mock_print, mock_input_confirm):
check_ini_file(self, self.cfg.config_file,
NIH_SECTION, 'is_nih', 'False')


@patch('inquirer.confirm', side_effect=[True, True, False])
@patch('inquirer.prompt', return_value={'shared_dir': SHARED_DIR})
def test_set_nih_when_shared_config(self, mock_print, mock_input_confirm, mock_input_promp):
Expand All @@ -555,14 +554,15 @@ def test_set_nih_when_shared_config(self, mock_print, mock_input_confirm, mock_i

# Check that the configuration file was updated correctly
check_ini_file(self, self.cfg.shared_config_file,
NIH_SECTION, 'is_nih', 'True')
NIH_SECTION, 'is_nih', 'True')

# Call set_user method
self.assertTrue(self.cfg.set_nih())

# Check that the configuration file was updated correctly
check_ini_file(self, self.cfg.shared_config_file,
NIH_SECTION, 'is_nih', 'False')
NIH_SECTION, 'is_nih', 'False')


@patch('builtins.print')
class TestConfigS3(unittest.TestCase):
Expand Down Expand Up @@ -670,7 +670,6 @@ def test_set_s3(self, mock_print, mock_input_list, mock_input_text):
# Check the bucket was created
self.assertIn(S3_BUCKET_NAME, s3_buckets)


@patch('inquirer.list_input', side_effect=['+ Create new bucket', S3_STORAGE_CLASS])
@patch('inquirer.text', side_effect=[S3_BUCKET_NAME, S3_ARCHIVE_DIR])
@patch('inquirer.confirm', side_effect=[True])
Expand All @@ -686,13 +685,13 @@ def test_set_s3_when_shared_config(self, mock_print, mock_input_list, mock_input

# Check that the configuration files were updated correctly
check_ini_file(self, self.cfg.shared_config_file,
S3_SECTION, 'bucket_name', S3_BUCKET_NAME)
S3_SECTION, 'bucket_name', S3_BUCKET_NAME)

check_ini_file(self, self.cfg.shared_config_file,
S3_SECTION, 'archive_dir', S3_ARCHIVE_DIR)
S3_SECTION, 'archive_dir', S3_ARCHIVE_DIR)

check_ini_file(self, self.cfg.shared_config_file,
S3_SECTION, 'storage_class', S3_STORAGE_CLASS)
S3_SECTION, 'storage_class', S3_STORAGE_CLASS)

# Check that the s3_init is set
self.assertTrue(self.cfg.s3_init)
Expand Down Expand Up @@ -759,32 +758,32 @@ def test_set_s3_select_bucket(self, mock_print, mock_input_list, mock_input_text
# # Check that the configuration files were updated correctly
# check_ini_file(self, self.cfg.config_file,
# 'SLURM', 'slurm_walltime_days', str(SLURM_WALLTIME_DAYS))

# check_ini_file(self, self.cfg.config_file,
# 'SLURM', 'slurm_walltime_hours', str(SLURM_WALLTIME_HOURS))

# check_ini_file(self, self.cfg.config_file,
# 'SLURM', 'slurm_partition', SLURM_PARTITION)

# check_ini_file(self, self.cfg.config_file,
# 'SLURM', 'slurm_qos', SLURM_QOS)

# check_ini_file(self, self.cfg.config_file,
# 'SLURM', 'slurm_lscratch', SLURM_LOCAL_SCRATCH)

# check_ini_file(self, self.cfg.config_file,
# 'SLURM', 'lscratch_mkdir', SLURM_SCRIPT_SCRATCH)

# check_ini_file(self, self.cfg.config_file,
# 'SLURM', 'lscratch_rmdir', SLURM_SCRIPT_TEARS_DOWN)

# check_ini_file(self, self.cfg.config_file,
# 'SLURM', 'lscratch_root', SLURM_ROOT)


if __name__ == '__main__':

if False:
if True:
unittest.main(verbosity=2)
else:
suite = unittest.TestSuite()
Expand Down

0 comments on commit 71eea7f

Please sign in to comment.