Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
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
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
esde
machine-learning
MLAir
Commits
a3e31215
Commit
a3e31215
authored
5 years ago
by
Felix Kleinert
Browse files
Options
Downloads
Patches
Plain Diff
first testst for partition_ceheck
#106
parent
e922eb1c
No related branches found
No related tags found
3 merge requests
!125
Release v0.10.0
,
!124
Update Master to new version v0.10.0
,
!97
Felix issue106 hpc modules for juwels
Pipeline
#33927
passed
5 years ago
Stage: test
Stage: pages
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_modules/test_partition_check.py
+76
-0
76 additions, 0 deletions
test/test_modules/test_partition_check.py
with
76 additions
and
0 deletions
test/test_modules/test_partition_check.py
+
76
−
0
View file @
a3e31215
import
logging
import
pytest
import
mock
from
src.run_modules.experiment_setup
import
ExperimentSetup
from
src.run_modules.partition_check
import
PartitionCheck
from
src.run_modules.run_environment
import
RunEnvironment
from
src.helpers
import
get_host
from
src.helpers
import
PyTestRegex
class
TestPartitionCheck
:
# @pytest.fixture
# def obj_super_init(self):
# obj = object.__new__(PartitionCheck)
# super(PartitionCheck, obj).__init__()
# obj.data_store.set("NAME1", 1, "general")
# yield obj
# RunEnvironment().__del__()
@pytest.fixture
@mock.patch
(
"
src.helpers.get_host
"
,
return_value
=
"
juwels
"
)
@mock.patch
(
"
getpass.getuser
"
,
return_value
=
"
testUser
"
)
@mock.patch
(
"
os.path.exists
"
,
return_value
=
False
)
@mock.patch
(
"
os.makedirs
"
,
side_effect
=
None
)
def
obj_with_exp_setup_login
(
self
,
mock_host
,
mock_user
,
mock_path
,
mock_check
):
ExperimentSetup
(
parser_args
=
{},
stations
=
[
'
DEBW107
'
,
'
DEBY081
'
,
'
DEBW013
'
,
'
DEBW076
'
,
'
DEBW087
'
,
'
DEBW001
'
],
statistics_per_var
=
{
'
o3
'
:
'
dma8eu
'
,
'
temp
'
:
'
maximum
'
},
station_type
=
"
background
"
)
pre
=
object
.
__new__
(
PartitionCheck
)
super
(
PartitionCheck
,
pre
).
__init__
()
yield
pre
RunEnvironment
().
__del__
()
@pytest.fixture
@mock.patch
(
"
src.helpers.get_host
"
,
return_value
=
"
jwtest
"
)
@mock.patch
(
"
getpass.getuser
"
,
return_value
=
"
testUser
"
)
@mock.patch
(
"
os.path.exists
"
,
return_value
=
False
)
@mock.patch
(
"
os.makedirs
"
,
side_effect
=
None
)
def
obj_with_exp_setup_compute
(
self
,
mock_host
,
mock_user
,
mock_path
,
mock_check
):
ExperimentSetup
(
parser_args
=
{},
stations
=
[
'
DEBW107
'
,
'
DEBY081
'
,
'
DEBW013
'
,
'
DEBW076
'
,
'
DEBW087
'
,
'
DEBW001
'
],
statistics_per_var
=
{
'
o3
'
:
'
dma8eu
'
,
'
temp
'
:
'
maximum
'
},
station_type
=
"
background
"
)
pre
=
object
.
__new__
(
PartitionCheck
)
super
(
PartitionCheck
,
pre
).
__init__
()
yield
pre
RunEnvironment
().
__del__
()
def
test_init
(
self
,
caplog
):
ExperimentSetup
(
parser_args
=
{},
stations
=
[
'
DEBW107
'
,
'
DEBY081
'
,
'
DEBW013
'
,
'
DEBW076
'
,
'
DEBW087
'
],
statistics_per_var
=
{
'
o3
'
:
'
dma8eu
'
,
'
temp
'
:
'
maximum
'
})
caplog
.
clear
()
caplog
.
set_level
(
logging
.
INFO
)
with
PartitionCheck
():
assert
caplog
.
record_tuples
[
0
]
==
(
'
root
'
,
20
,
'
PartitionCheck started
'
)
RunEnvironment
().
__del__
()
@mock.patch
(
"
src.helpers.get_host
"
,
return_value
=
"
juwels
"
)
@mock.patch
(
"
getpass.getuser
"
,
return_value
=
"
testUser
"
)
@mock.patch
(
"
os.path.exists
"
,
return_value
=
False
)
@mock.patch
(
"
os.makedirs
"
,
side_effect
=
None
)
def
test_run_login
(
self
,
mock_host
,
mock_user
,
mock_path
,
mock_check
,
obj_with_exp_setup_login
,
caplog
):
with
pytest
.
raises
(
OSError
)
as
e
:
obj_with_exp_setup_login
.
__next__
().
_run
()
assert
"
You are on a login node to download data. Use compute nodes and run again if you want to train and
"
\
"
validate a model.
"
==
\
e
.
value
.
args
[
0
]
@mock.patch
(
"
src.helpers.get_host
"
,
return_value
=
"
jwtest
"
)
@mock.patch
(
"
getpass.getuser
"
,
return_value
=
"
testUser
"
)
@mock.patch
(
"
os.path.exists
"
,
return_value
=
False
)
@mock.patch
(
"
os.makedirs
"
,
side_effect
=
None
)
def
test_run_compute
(
self
,
mock_host
,
mock_user
,
mock_path
,
mock_check
,
obj_with_exp_setup_compute
,
caplog
):
assert
obj_with_exp_setup_compute
.
__next__
().
_run
()
is
None
This diff is collapsed.
Click to expand it.
Ghost User
@ghost
mentioned in issue
#106 (closed)
·
5 years ago
mentioned in issue
#106 (closed)
mentioned in issue #106
Toggle commit list
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