Skip to content

Unskipped tests for Windows #21702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion python/ray/serve/tests/test_failure.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ def __call__(self, *args):

# Test that if there are multiple replicas for a worker and one dies
# unexpectedly, the others continue to serve requests.
@pytest.mark.skipif(sys.platform == "win32", reason="Failing on Windows.")
def test_worker_replica_failure(serve_instance):
@ray.remote
class Counter:
Expand Down
6 changes: 6 additions & 0 deletions python/ray/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ py_test_module_list(
"test_unhandled_error.py",
"test_top_level_api.py",
"test_list_actors.py",
"test_list_actors_2.py",
"test_list_actors_3.py",
"test_list_actors_4.py",
"test_usage_stats.py",
],
size = "small",
Expand Down Expand Up @@ -332,6 +335,9 @@ py_test_module_list(
"test_asyncio.py",
"test_multiprocessing.py",
"test_list_actors.py",
"test_list_actors_2.py",
"test_list_actors_3.py",
"test_list_actors_4.py",
],
size = "medium",
extra_srcs = SRCS,
Expand Down
2 changes: 1 addition & 1 deletion python/ray/tests/test_client_terminate.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def mock_terminate(self, term):


if __name__ == "__main__":
import sys
import pytest
import sys

sys.exit(pytest.main(["-v", __file__]))
3 changes: 0 additions & 3 deletions python/ray/tests/test_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ def test_filter(ray_start_regular_shared):
assert list(it.gather_sync()) == [0, 2, 1]


@pytest.mark.skipif(sys.platform == "win32", reason="Failing on Windows.")
def test_local_shuffle(ray_start_regular_shared):
# confirm that no data disappears, and they all stay within the same shard
it = from_range(8, num_shards=2).local_shuffle(shuffle_buffer_size=2)
Expand Down Expand Up @@ -561,6 +560,4 @@ def get(it):


if __name__ == "__main__":
import sys

sys.exit(pytest.main(["-v", __file__]))
109 changes: 1 addition & 108 deletions python/ray/tests/test_list_actors.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import os
import pytest
import sys

import ray
from ray._private.test_utils import run_string_as_driver, wait_for_condition
from ray._private.test_utils import wait_for_condition


def test_list_named_actors_basic(ray_start_regular):
Expand Down Expand Up @@ -53,112 +52,6 @@ class A:
assert "hi2" in ray.util.list_named_actors()


@pytest.mark.skipif(sys.platform == "win32", reason="Flaky on Windows.")
def test_list_named_actors_restarting_actor(ray_start_regular):
@ray.remote(max_restarts=-1)
class A:
def __init__(self):
os._exit(0)

a = A.options(name="hi").remote()
for _ in range(10000):
assert ray.util.list_named_actors() == ["hi"]

del a
wait_for_condition(lambda: not ray.util.list_named_actors())


def test_list_named_actors_ray_kill(ray_start_regular):
"""Verify that names are returned even while actors are restarting."""

@ray.remote(max_restarts=-1)
class A:
def __init__(self):
pass

a = A.options(name="hi").remote()
assert ray.util.list_named_actors() == ["hi"]
ray.kill(a, no_restart=False)
assert ray.util.list_named_actors() == ["hi"]
ray.kill(a, no_restart=True)
assert not ray.util.list_named_actors()


def test_list_named_actors_detached(ray_start_regular):
"""Verify that names are returned for detached actors until killed."""
address = ray_start_regular["address"]

driver_script = """
import ray
ray.init(address="{}", namespace="default_test_namespace")

@ray.remote
class A:
pass

A.options(name="hi", lifetime="detached").remote()
a = A.options(name="sad").remote()

assert len(ray.util.list_named_actors()) == 2
assert "hi" in ray.util.list_named_actors()
assert "sad" in ray.util.list_named_actors()
""".format(
address
)

run_string_as_driver(driver_script)

assert ray.util.list_named_actors() == ["hi"]


@pytest.mark.skipif(sys.platform == "win32", reason="Flaky on Windows.")
def test_list_named_actors_namespace(ray_start_regular):
"""Verify that actor names are filtered on namespace by default."""
address = ray_start_regular["address"]

driver_script_1 = """
import ray
ray.init(address="{}", namespace="test")

@ray.remote
class A:
pass

A.options(name="hi", lifetime="detached").remote()

assert len(ray.util.list_named_actors()) == 1
assert ray.util.list_named_actors() == ["hi"]
assert ray.util.list_named_actors(all_namespaces=True) == \
[dict(name="hi", namespace="test")]
""".format(
address
)

run_string_as_driver(driver_script_1)

assert not ray.util.list_named_actors()
assert ray.util.list_named_actors(all_namespaces=True) == [
{"name": "hi", "namespace": "test"}
]

driver_script_2 = """
import ray
ray.init(address="{}", namespace="test")

assert ray.util.list_named_actors() == ["hi"]
assert ray.util.list_named_actors(all_namespaces=True) == \
[dict(name="hi", namespace="test")]
ray.kill(ray.get_actor("hi"), no_restart=True)
assert not ray.util.list_named_actors()
""".format(
address
)

run_string_as_driver(driver_script_2)
assert not ray.util.list_named_actors()
assert not ray.util.list_named_actors(all_namespaces=True)


if __name__ == "__main__":
# Test suite is timing out. Disable on windows for now.
sys.exit(pytest.main(["-v", __file__]))
25 changes: 25 additions & 0 deletions python/ray/tests/test_list_actors_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
import pytest
import sys

import ray
from ray._private.test_utils import wait_for_condition


def test_list_named_actors_restarting_actor(ray_start_regular):
@ray.remote(max_restarts=-1)
class A:
def __init__(self):
os._exit(0)

a = A.options(name="hi").remote()
for _ in range(10000):
assert ray.util.list_named_actors() == ["hi"]

del a
wait_for_condition(lambda: not ray.util.list_named_actors())


if __name__ == "__main__":
# Test suite is timing out. Disable on windows for now.
sys.exit(pytest.main(["-v", __file__]))
53 changes: 53 additions & 0 deletions python/ray/tests/test_list_actors_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import pytest
import sys

import ray
from ray._private.test_utils import run_string_as_driver


def test_list_named_actors_ray_kill(ray_start_regular):
"""Verify that names are returned even while actors are restarting."""

@ray.remote(max_restarts=-1)
class A:
def __init__(self):
pass

a = A.options(name="hi").remote()
assert ray.util.list_named_actors() == ["hi"]
ray.kill(a, no_restart=False)
assert ray.util.list_named_actors() == ["hi"]
ray.kill(a, no_restart=True)
assert not ray.util.list_named_actors()


def test_list_named_actors_detached(ray_start_regular):
"""Verify that names are returned for detached actors until killed."""
address = ray_start_regular["address"]

driver_script = """
import ray
ray.init(address="{}", namespace="default_test_namespace")

@ray.remote
class A:
pass

A.options(name="hi", lifetime="detached").remote()
a = A.options(name="sad").remote()

assert len(ray.util.list_named_actors()) == 2
assert "hi" in ray.util.list_named_actors()
assert "sad" in ray.util.list_named_actors()
""".format(
address
)

run_string_as_driver(driver_script)

assert ray.util.list_named_actors() == ["hi"]


if __name__ == "__main__":
# Test suite is timing out. Disable on windows for now.
sys.exit(pytest.main(["-v", __file__]))
57 changes: 57 additions & 0 deletions python/ray/tests/test_list_actors_4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import pytest
import sys

import ray
from ray._private.test_utils import run_string_as_driver


def test_list_named_actors_namespace(ray_start_regular):
"""Verify that actor names are filtered on namespace by default."""
address = ray_start_regular["address"]

driver_script_1 = """
import ray
ray.init(address="{}", namespace="test")

@ray.remote
class A:
pass

A.options(name="hi", lifetime="detached").remote()

assert len(ray.util.list_named_actors()) == 1
assert ray.util.list_named_actors() == ["hi"]
assert ray.util.list_named_actors(all_namespaces=True) == \
[dict(name="hi", namespace="test")]
""".format(
address
)

run_string_as_driver(driver_script_1)

assert not ray.util.list_named_actors()
assert ray.util.list_named_actors(all_namespaces=True) == [
{"name": "hi", "namespace": "test"}
]

driver_script_2 = """
import ray
ray.init(address="{}", namespace="test")

assert ray.util.list_named_actors() == ["hi"]
assert ray.util.list_named_actors(all_namespaces=True) == \
[dict(name="hi", namespace="test")]
ray.kill(ray.get_actor("hi"), no_restart=True)
assert not ray.util.list_named_actors()
""".format(
address
)

run_string_as_driver(driver_script_2)
assert not ray.util.list_named_actors()
assert not ray.util.list_named_actors(all_namespaces=True)


if __name__ == "__main__":
# Test suite is timing out. Disable on windows for now.
sys.exit(pytest.main(["-v", __file__]))
1 change: 0 additions & 1 deletion python/ray/tests/test_multi_tenancy.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def test_initial_workers(shutdown_only):
# all the PIDs don't overlap. If overlapped, it means that tasks owned by
# different drivers were scheduled to the same worker process, that is, tasks
# of different jobs were not correctly isolated during execution.
@pytest.mark.skipif(sys.platform == "win32", reason="Failing on Windows.")
def test_multi_drivers(shutdown_only):
info = ray.init(num_cpus=10)

Expand Down