Skip to content

Commit

Permalink
Add tests for the new Engine.resources property.
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardomurri committed Jun 26, 2017
1 parent f8de61b commit 9807b2f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
17 changes: 16 additions & 1 deletion gc3libs/tests/test_core.py
Expand Up @@ -29,7 +29,22 @@
from gc3libs.core import Core, MatchMaker
from gc3libs.quantity import GB, hours

from gc3libs.testing.helpers import temporary_config_file
from gc3libs.testing.helpers import temporary_config_file, temporary_core


def test_core_resources():
"""
Check that configured resources can be accessed through the `Core` object.
"""
with temporary_core() as core:
resources = core.resources
assert len(resources) == 1
assert 'test' in resources
test_rsc = resources['test']
# these should match the resource definition in `gc3libs.testing.helpers.temporary_core`
assert test_rsc.max_cores_per_job == 1
assert test_rsc.max_memory_per_core == 1*GB
assert test_rsc.max_walltime == 8*hours


def test_core_disable_resource_on_auth_init_failure():
Expand Down
15 changes: 15 additions & 0 deletions gc3libs/tests/test_engine.py
Expand Up @@ -37,6 +37,21 @@
from gc3libs.testing.helpers import SimpleParallelTaskCollection, SimpleSequentialTaskCollection, SuccessfulApp, temporary_config, temporary_config_file, temporary_core, temporary_directory, temporary_engine


def test_engine_resources():
"""
Check that configured resources can be accessed through the `Engine` object.
"""
with temporary_engine() as engine:
resources = engine.resources
assert len(resources) == 1
assert 'test' in resources
test_rsc = resources['test']
# these should match the resource definition in `gc3libs.testing.helpers.temporary_core`
assert test_rsc.max_cores_per_job == 1
assert test_rsc.max_memory_per_core == 1*GB
assert test_rsc.max_walltime == 8*hours


def test_engine_progress(num_jobs=1, transition_graph=None, max_iter=100):
with temporary_engine() as engine:

Expand Down

0 comments on commit 9807b2f

Please sign in to comment.