Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
force-bdss
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adham Hashibon
force-bdss
Commits
0b743ec5
Commit
0b743ec5
authored
6 years ago
by
Stefano Borini
Browse files
Options
Downloads
Patches
Plain Diff
coverage
parent
471dac40
No related branches found
No related tags found
1 merge request
!138
More robust logging for BDSS
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
force_bdss/tests/probe_classes/mco.py
+8
-2
8 additions, 2 deletions
force_bdss/tests/probe_classes/mco.py
force_bdss/tests/test_core_mco_driver.py
+30
-0
30 additions, 0 deletions
force_bdss/tests/test_core_mco_driver.py
with
38 additions
and
2 deletions
force_bdss/tests/probe_classes/mco.py
+
8
−
2
View file @
0b743ec5
from
traits.api
import
Bool
,
Int
,
Function
from
traits.api
import
Bool
,
Int
,
Function
,
Any
from
force_bdss.core.data_value
import
DataValue
from
force_bdss.api
import
(
...
...
@@ -71,6 +71,12 @@ class ProbeMCOFactory(BaseMCOFactory):
raises_on_create_optimizer
=
Bool
(
False
)
raises_on_create_communicator
=
Bool
(
False
)
optimizer
=
Any
()
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
ProbeMCOFactory
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
optimizer
=
self
.
optimizer_class
(
self
)
def
get_identifier
(
self
):
return
"
probe_mco
"
...
...
@@ -107,7 +113,7 @@ class ProbeMCOFactory(BaseMCOFactory):
if
self
.
raises_on_create_optimizer
:
raise
Exception
(
"
ProbeMCOFactory.create_optimizer
"
)
return
self
.
optimizer
_class
(
self
)
return
self
.
optimizer
def
parameter_factories
(
self
):
return
[
ProbeParameterFactory
(
mco_factory
=
self
)]
This diff is collapsed.
Click to expand it.
force_bdss/tests/test_core_mco_driver.py
+
30
−
0
View file @
0b743ec5
...
...
@@ -175,3 +175,33 @@ class TestCoreMCODriver(unittest.TestCase):
"'
force.bdss.enthought.plugin.test.v0
'
.
"
"
An exception was raised. This might
"
'
indicate a programming error in the plugin.
'
),)
with
LogCapture
()
as
capture
:
with
self
.
assertRaises
(
SystemExit
):
driver
.
application_started
()
def
test_mco_run_exception
(
self
):
def
run_func
(
*
args
,
**
kwargs
):
raise
Exception
(
"
run_func
"
)
driver
=
CoreMCODriver
(
application
=
self
.
mock_application
,
)
registry
=
self
.
factory_registry_plugin
mco_factory
=
registry
.
mco_factories
[
0
]
mco_factory
.
optimizer
.
run_function
=
run_func
with
LogCapture
()
as
capture
:
with
self
.
assertRaises
(
SystemExit
):
driver
.
application_started
()
capture
.
check
((
'
force_bdss.core_mco_driver
'
,
'
ERROR
'
,
'
Method run() of MCO with id
'
"'
force.bdss.enthought.plugin.test.v0
"
"
.factory.probe_mco
'
from plugin
"
"'
force.bdss.enthought.plugin.test.v0
'"
"
raised exception. This might indicate
"
'
a programming error in the plugin.
'
),)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment