Skip to content

Commit

Permalink
Fix no cpus test (#5009)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangzihao2009 authored and raulchen committed Jun 21, 2019
1 parent 3b23d94 commit a7f84b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions python/ray/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ def _ray_start(**kwargs):
ray.shutdown()


# The following fixture will start ray with 0 cpu.
@pytest.fixture
def ray_start_no_cpu(request):
param = getattr(request, "param", {})
with _ray_start(num_cpus=0, **param) as res:
yield res


# The following fixture will start ray with 1 cpu.
@pytest.fixture
def ray_start_regular(request):
Expand Down
2 changes: 1 addition & 1 deletion python/ray/tests/test_actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ def f():
assert actor_id not in resulting_ids


def test_actors_on_nodes_with_no_cpus(ray_start_regular):
def test_actors_on_nodes_with_no_cpus(ray_start_no_cpu):
@ray.remote
class Foo(object):
def method(self):
Expand Down

0 comments on commit a7f84b5

Please sign in to comment.