Skip to content

Commit

Permalink
WIP package version upgrade
Browse files Browse the repository at this point in the history
- fix unit test (thx SC)
  • Loading branch information
mvesin committed May 23, 2023
1 parent ca42dd0 commit 427bfb6
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions tests/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from fedbiomed.researcher.job import Job
from fedbiomed.researcher.requests import Requests
from fedbiomed.researcher.responses import Responses

import fedbiomed.researcher.job # needed for specific mocking


class TestJob(ResearcherTestCase):
Expand Down Expand Up @@ -189,18 +189,17 @@ def test_job_init_05_build_wrongly_saved_model(self, mock_logger_critical):
mock_logger_critical.assert_called_once()

@patch('fedbiomed.common.logger.logger.critical')
@patch('inspect.isclass')
def test_job_06_init_isclass_raises_error(self,
mock_isclass,
mock_logger_critical):
""" Test initialization when inspect.isclass raises NameError"""

mock_isclass.side_effect = NameError
with self.assertRaises(NameError):
_ = Job(training_plan_class='FakeModel',
training_args=TrainingArgs({"batch_size": 12}, only_required=False),
data=self.fds)
mock_logger_critical.assert_called_once()
with patch.object(fedbiomed.researcher.job, 'inspect') as mock_inspect:
mock_inspect.isclass.side_effect = NameError
with self.assertRaises(NameError):
_ = Job(training_plan_class='FakeModel',
training_args=TrainingArgs({"batch_size": 12}, only_required=False),
data=self.fds)
mock_logger_critical.assert_called_once()

@patch('fedbiomed.common.logger.logger.error')
def test_job_07_initialization_raising_exception_save_and_save_code(self,
Expand Down

0 comments on commit 427bfb6

Please sign in to comment.