Skip to content

Commit

Permalink
Create public function to get workflow jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindeide committed Sep 3, 2020
1 parent d59e751 commit a05ecf3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
8 changes: 4 additions & 4 deletions ert_shared/plugins/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def _site_config_lines(self):
return list(chain.from_iterable(reversed(plugin_site_config_lines)))

@python3only
def _get_workflow_jobs(self):
config_workflow_jobs = self._get_installable_workflow_jobs()
def get_installable_workflow_jobs(self):
config_workflow_jobs = self._get_config_workflow_jobs()
hooked_workflow_jobs = self.get_ertscript_workflows().get_workflows()
installable_workflow_jobs = self._merge_internal_jobs(
config_workflow_jobs, hooked_workflow_jobs
Expand Down Expand Up @@ -159,7 +159,7 @@ def get_site_config_content(self):

site_config_lines.extend(install_job_lines + [""])

installable_workflow_jobs = self._get_workflow_jobs()
installable_workflow_jobs = self.get_installable_workflow_jobs()

install_workflow_job_lines = [
"LOAD_WORKFLOW_JOB {}".format(job_path)
Expand Down Expand Up @@ -213,7 +213,7 @@ def get_installable_jobs(self):
return ErtPluginManager._merge_dicts(self.hook.installable_jobs())

@python3only
def _get_installable_workflow_jobs(self):
def _get_config_workflow_jobs(self):
return ErtPluginManager._merge_dicts(self.hook.installable_workflow_jobs())

@python3only
Expand Down
12 changes: 5 additions & 7 deletions tests/all/plugins/test_plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_no_plugins(self):
self.assertIsNone(pm.get_rms_config_path())

self.assertLess(0, len(pm.get_installable_jobs()))
self.assertLess(0, len(pm._get_installable_workflow_jobs()))
self.assertLess(0, len(pm._get_config_workflow_jobs()))

self.assertListEqual(
[
Expand Down Expand Up @@ -62,12 +62,10 @@ def test_with_plugins(self):
self.assertIn(("job1", "/dummy/path/job1"), pm.get_installable_jobs().items())
self.assertIn(("job2", "/dummy/path/job2"), pm.get_installable_jobs().items())
self.assertIn(
("wf_job1", "/dummy/path/wf_job1"),
pm._get_installable_workflow_jobs().items(),
("wf_job1", "/dummy/path/wf_job1"), pm._get_config_workflow_jobs().items(),
)
self.assertIn(
("wf_job2", "/dummy/path/wf_job2"),
pm._get_installable_workflow_jobs().items(),
("wf_job2", "/dummy/path/wf_job2"), pm._get_config_workflow_jobs().items(),
)

self.assertListEqual(
Expand Down Expand Up @@ -108,7 +106,7 @@ def test_job_documentation(self):
)
def test_plugin_manager_python_2(self):
pm = ErtPluginManager()
self.assertEqual(pm._get_installable_workflow_jobs(), None)
self.assertEqual(pm._get_config_workflow_jobs(), None)
self.assertEqual(pm.get_installable_jobs(), None)
self.assertEqual(pm.get_flow_config_path(), None)
self.assertEqual(pm.get_ecl100_config_path(), None)
Expand All @@ -128,7 +126,7 @@ def test_workflows_merge(monkeypatch, tmpdir):
tempfile_mock = Mock(return_value=tmpdir)
monkeypatch.setattr(tempfile, "mkdtemp", tempfile_mock)
pm = ErtPluginManager(plugins=[dummy_plugins])
result = pm._get_workflow_jobs()
result = pm.get_installable_workflow_jobs()
assert result == expected_result


Expand Down

0 comments on commit a05ecf3

Please sign in to comment.