Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.cmdline
Commits
4aa391e2
Commit
4aa391e2
authored
Oct 22, 2019
by
Samuel GAIST
Browse files
[test][algorithms] Add fork test setup
parent
e37e8026
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/cmdline/test/test_algorithms.py
View file @
4aa391e2
...
...
@@ -39,10 +39,12 @@
import
nose.tools
from
beat.core.algorithm
import
Storage
from
beat.core.algorithm
import
Algorithm
from
beat.core.dataformat
import
Storage
as
DFStorage
from
beat.core.library
import
Storage
as
LibStorage
from
.
import
core
from
.
import
tmp_prefix
from
.
import
tmp_prefix
,
prefix
class
TestOnlineAlgorithms
(
core
.
OnlineAssetTestCase
):
...
...
@@ -53,6 +55,8 @@ class TestOnlineAlgorithms(core.OnlineAssetTestCase):
"pull"
:
"user/integers_add/1"
,
"diff"
:
"user/integers_add/1"
,
"create"
:
"user/newobject/1"
,
"fork_from"
:
"user/unknown/1"
,
"fork"
:
"user/forked_obj/1"
,
"push"
:
"user/db_input_loop_processor/1"
,
"not_owner_push"
:
"v1/integers_add/1"
,
}
...
...
@@ -63,6 +67,22 @@ class TestOnlineAlgorithms(core.OnlineAssetTestCase):
storage
=
self
.
storage_cls
(
tmp_prefix
,
asset_name
)
storage
.
code
.
save
(
"class Algorithm:
\n
pass"
)
def
_prepare_fork_dependencies
(
self
,
asset_name
):
super
().
_prepare_fork_dependencies
(
asset_name
)
algorithm
=
Algorithm
(
prefix
,
asset_name
)
for
lib
in
algorithm
.
libraries
.
keys
():
src_storage
=
LibStorage
(
prefix
,
lib
)
dst_storage
=
LibStorage
(
tmp_prefix
,
lib
)
dst_storage
.
save
(
*
src_storage
.
load
())
for
dataformat
in
algorithm
.
dataformats
.
keys
():
if
dataformat
.
startswith
(
"user"
):
src_storage
=
DFStorage
(
prefix
,
dataformat
)
dst_storage
=
DFStorage
(
tmp_prefix
,
dataformat
)
dst_storage
.
save
(
*
src_storage
.
load
())
class
TestAlgorithmLocal
(
core
.
AssetLocalTest
):
storage_cls
=
Storage
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment