Convert runtest.py to use pytest. (#2966)

* Convert runtest.py to use pytest.

* Linting.

* Fix

* Fix

* Fix

* Fix
This commit is contained in:
Robert Nishihara
2018-09-30 07:59:44 -07:00
committed by Philipp Moritz
parent 65dcafdc3f
commit ed6289771a
3 changed files with 2035 additions and 2046 deletions
+2 -8
View File
@@ -135,10 +135,7 @@ matrix:
- python -m pytest -v python/ray/test/test_queue.py
- python -m pytest -v test/xray_test.py
# The --assert=plain here is because pytest's assertion
# rewriting mechanism seems to mess up on this file,
# see https://github.com/ray-project/ray/issues/2514
- python -m pytest -v --assert=plain test/runtest.py
- python -m pytest -v test/runtest.py
- python -m pytest -v test/array_test.py
- python -m pytest -v test/actor_test.py
- python -m pytest -v test/autoscaler_test.py
@@ -210,10 +207,7 @@ script:
- python -m pytest -v python/ray/test/test_queue.py
- python -m pytest -v test/xray_test.py
# The --assert=plain here is because pytest's assertion
# rewriting mechanism seems to mess up on this file,
# see https://github.com/ray-project/ray/issues/2514
- python -m pytest --assert=plain -v test/runtest.py
- python -m pytest -v test/runtest.py
- python -m pytest -v test/array_test.py
- python -m pytest -v test/actor_test.py
- python -m pytest -v test/autoscaler_test.py
+2018 -2032
View File
File diff suppressed because it is too large Load Diff
+15 -6
View File
@@ -11,11 +11,20 @@ import ray
import ray.ray_constants as ray_constants
@pytest.fixture
def ray_start_regular():
@pytest.fixture(params=[1, 20])
def ray_start_sharded(request):
num_redis_shards = request.param
if os.environ.get("RAY_USE_NEW_GCS") == "on":
num_redis_shards = 1
# For now, RAY_USE_NEW_GCS supports 1 shard, and credis supports
# 1-node chain for that shard only.
# Start the Ray processes.
ray.init(num_cpus=10)
ray.init(num_cpus=10, num_redis_shards=num_redis_shards)
yield None
# The code after the yield will run as teardown code.
ray.shutdown()
@@ -78,7 +87,7 @@ def test_dependencies(ray_start_combination):
assert ray.services.all_processes_alive()
def test_submitting_many_tasks(ray_start_regular):
def test_submitting_many_tasks(ray_start_sharded):
@ray.remote
def f(x):
return 1
@@ -93,7 +102,7 @@ def test_submitting_many_tasks(ray_start_regular):
assert ray.services.all_processes_alive()
def test_getting_and_putting(ray_start_regular):
def test_getting_and_putting(ray_start_sharded):
for n in range(8):
x = np.zeros(10**n)
@@ -107,7 +116,7 @@ def test_getting_and_putting(ray_start_regular):
assert ray.services.all_processes_alive()
def test_getting_many_objects(ray_start_regular):
def test_getting_many_objects(ray_start_sharded):
@ray.remote
def f():
return 1