diff --git a/.travis.yml b/.travis.yml index d7f3a2bea34c..a8a63caee9f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,14 +26,14 @@ matrix: - JDK='Oracle JDK 8' - PYTHON=3.5 PYTHONWARNINGS=ignore install: - - ./.travis/install-dependencies.sh + - ./ci/travis/install-dependencies.sh - export PATH="$HOME/miniconda/bin:$PATH" script: - ./java/test.sh # Test Bazel build - rm -rf build - - ./.travis/install-bazel.sh + - ./ci/travis/install-bazel.sh - bazel build ... - os: linux @@ -47,10 +47,10 @@ matrix: - sudo apt-get install -qq clang-format-3.8 install: [] script: - - .travis/check-git-clang-format-output.sh + - ./ci/travis/check-git-clang-format-output.sh # Try generating Sphinx documentation. To do this, we need to install # Ray first. - - ./.travis/install-dependencies.sh + - ./ci/travis/install-dependencies.sh - export PATH="$HOME/miniconda/bin:$PATH" - cd doc - pip install -q -r requirements-doc.txt @@ -59,7 +59,7 @@ matrix: - cd .. # Run Python linting, ignore dict vs {} (C408), others are defaults - flake8 --exclude=python/ray/core/generated/,doc/source/conf.py,python/ray/cloudpickle/ --ignore=C408,E121,E123,E126,E226,E24,E704,W503,W504,W605 - - .travis/format.sh --all + - ./ci/travis/format.sh --all # Make sure that the README is formatted properly. - cd python - python setup.py check --restructuredtext --strict --metadata @@ -72,7 +72,7 @@ matrix: - export GOPATH="$HOME/go_dir" - export PATH="$GOROOT/bin:$GOPATH/bin:$PATH" - go get github.com/bazelbuild/buildtools/buildifier - - ./.travis/bazel-format.sh + - ./ci/travis/bazel-format.sh - os: linux dist: trusty @@ -81,10 +81,10 @@ matrix: - sudo apt-get update -qq - sudo apt-get install -qq valgrind install: - - ./.travis/install-dependencies.sh + - ./ci/travis/install-dependencies.sh - export PATH="$HOME/miniconda/bin:$PATH" - - ./.travis/install-ray.sh - - ./.travis/install-with-cache-libs.sh + - ./ci/travis/install-ray.sh + - ./ci/travis/install-with-cache-libs.sh script: - cd build @@ -98,10 +98,10 @@ matrix: # # Python3.5+ only. Otherwise we will get `SyntaxError` regardless of how we set the tester. - python -c 'import sys;exit(sys.version_info>=(3,5))' || python -m pytest -v --durations=10 python/ray/experimental/test/async_test.py - - python -m pytest -v --durations=10 test/mini_test.py - - python -m pytest -v --durations=10 test/array_test.py - - python -m pytest -v --durations=10 test/multi_node_test_2.py - - python -m pytest -v --durations=10 test/node_manager_test.py + - python -m pytest -v --durations=10 python/ray/tests/test_mini.py + - python -m pytest -v --durations=10 python/ray/tests/test_array.py + - python -m pytest -v --durations=10 python/ray/tests/test_multi_node_2.py + - python -m pytest -v --durations=10 python/ray/tests/test_node_manager.py # Build Linux wheels. @@ -109,22 +109,22 @@ matrix: dist: trusty env: LINUX_WHEELS=1 PYTHONWARNINGS=ignore install: - - ./.travis/install-dependencies.sh + - ./ci/travis/install-dependencies.sh # This command should be kept in sync with ray/python/README-building-wheels.md. - docker run --rm -w /ray -v `pwd`:/ray -ti quay.io/xhochy/arrow_manylinux1_x86_64_base:latest /ray/python/build-wheel-manylinux1.sh script: - - ./.travis/test-wheels.sh + - ./ci/travis/test-wheels.sh # Build MacOS wheels. - os: osx osx_image: xcode7 env: MAC_WHEELS=1 PYTHONWARNINGS=ignore install: - - ./.travis/install-dependencies.sh + - ./ci/travis/install-dependencies.sh # This command should be kept in sync with ray/python/README-building-wheels.md. - ./python/build-wheel-macos.sh script: - - ./.travis/test-wheels.sh + - ./ci/travis/test-wheels.sh # Test GCS integration - os: linux @@ -136,10 +136,10 @@ matrix: install: - - ./.travis/install-dependencies.sh + - ./ci/travis/install-dependencies.sh - export PATH="$HOME/miniconda/bin:$PATH" - - ./.travis/install-ray.sh - - ./.travis/install-cython-examples.sh + - ./ci/travis/install-ray.sh + - ./ci/travis/install-cython-examples.sh - cd build - bash ../src/ray/test/run_gcs_tests.sh @@ -162,7 +162,7 @@ script: # class definitions: The main module of tests that are run # with pytest have the same name as the test file -- and this # module is only found if the test directory is in the PYTHONPATH. - - export PYTHONPATH="$PYTHONPATH:./test/" + # - export PYTHONPATH="$PYTHONPATH:./ci/" # ray tune tests - python python/ray/tune/test/dependency_test.py @@ -182,43 +182,46 @@ script: # Python3.5+ only. Otherwise we will get `SyntaxError` regardless of how we set the tester. - python -c 'import sys;exit(sys.version_info>=(3,5))' || python -m pytest -v --durations=10 python/ray/experimental/test/async_test.py - - python -m pytest -v --durations=10 python/ray/test/test_global_state.py - - python -m pytest -v --durations=10 python/ray/test/test_queue.py - - python -m pytest -v --durations=10 python/ray/test/test_ray_init.py - - python -m pytest -v --durations=10 test/mini_test.py - - - python -m pytest -v --durations=10 test/runtest.py - - python -m pytest -v --durations=10 test/array_test.py - - python -m pytest -v --durations=10 test/actor_test.py - - python -m pytest -v --durations=10 test/autoscaler_test.py - - python -m pytest -v --durations=10 test/tensorflow_test.py - - python -m pytest -v --durations=10 test/failure_test.py - - python -m pytest -v --durations=10 test/microbenchmarks.py - - python -m pytest -v --durations=10 test/stress_tests.py - - python -m pytest -v --durations=10 test/component_failures_test.py - - python -m pytest -v --durations=10 test/multi_node_test.py - - python -m pytest -v --durations=10 test/multi_node_test_2.py - - python -m pytest -v --durations=10 test/recursion_test.py - - python -m pytest -v --durations=10 test/monitor_test.py - - python -m pytest -v --durations=10 test/cython_test.py - - python -m pytest -v --durations=10 test/credis_test.py - - python -m pytest -v --durations=10 test/node_manager_test.py - - python -m pytest -v --durations=10 test/test_signal.py + # ray tests + # TODO(williamma12): We cannot use pytests built-in test discovery because + # it causes a lot of the tests to fail on travis' apple builds even though + # it runs without issue on an apple build locally. + - python -m pytest -v --durations=10 python/ray/tests/test_global_state.py + - python -m pytest -v --durations=10 python/ray/tests/test_queue.py + - python -m pytest -v --durations=10 python/ray/tests/test_ray_init.py + - python -m pytest -v --durations=10 python/ray/tests/test_mini.py + + - python -m pytest -v --durations=10 python/ray/tests/test_basic.py + - python -m pytest -v --durations=10 python/ray/tests/test_array.py + - python -m pytest -v --durations=10 python/ray/tests/test_actor.py + - python -m pytest -v --durations=10 python/ray/tests/test_autoscaler.py + - python -m pytest -v --durations=10 python/ray/tests/test_tensorflow.py + - python -m pytest -v --durations=10 python/ray/tests/test_failure.py + - python -m pytest -v --durations=10 python/ray/tests/test_microbenchmarks.py + - python -m pytest -v --durations=10 python/ray/tests/test_stress.py + - python -m pytest -v --durations=10 python/ray/tests/test_component_failures.py + - python -m pytest -v --durations=10 python/ray/tests/test_multi_node.py + - python -m pytest -v --durations=10 python/ray/tests/test_multi_node_2.py + - python -m pytest -v --durations=10 python/ray/tests/test_recursion.py + - python -m pytest -v --durations=10 python/ray/tests/test_monitors.py + - python -m pytest -v --durations=10 python/ray/tests/test_cython.py + - python -m pytest -v --durations=10 python/ray/tests/test_credis.py + - python -m pytest -v --durations=10 python/ray/tests/test_node_manager.py + - python -m pytest -v --durations=10 python/ray/tests/test_signal.py # TODO(yuhguo): object_manager_test.py requires a lot of CPU/memory, and # better be put in Jenkins. However, it fails frequently in Jenkins, but # works well in Travis. We should consider moving it back to Jenkins once # we figure out the reason. - - python -m pytest -v --durations=10 test/object_manager_test.py + - python -m pytest -v --durations=10 python/ray/tests/test_object_manager.py # ray temp file tests - - python -m pytest -v --durations=10 test/tempfile_test.py + - python -m pytest -v --durations=10 python/ray/tests/test_tempfile.py # ray debug tools tests - - python -m pytest -v --durations=10 test/debug_tools_test.py + - python -m pytest -v --durations=10 python/ray/tests/test_debug_tools.py # modin test files - - python -m pytest -v --durations=10 python/ray/test/test_modin.py - + - python -m pytest -v --durations=10 python/ray/tests/test_modin.py deploy: - provider: s3 access_key_id: AKIAJ2L7XDUSZVTXI5QA diff --git a/test/jenkins_tests/multi_node_docker_test.py b/ci/jenkins_tests/multi_node_docker_test.py similarity index 100% rename from test/jenkins_tests/multi_node_docker_test.py rename to ci/jenkins_tests/multi_node_docker_test.py diff --git a/test/jenkins_tests/multi_node_tests/large_memory_test.py b/ci/jenkins_tests/multi_node_tests/large_memory_test.py similarity index 100% rename from test/jenkins_tests/multi_node_tests/large_memory_test.py rename to ci/jenkins_tests/multi_node_tests/large_memory_test.py diff --git a/test/jenkins_tests/multi_node_tests/many_drivers_test.py b/ci/jenkins_tests/multi_node_tests/many_drivers_test.py similarity index 95% rename from test/jenkins_tests/multi_node_tests/many_drivers_test.py rename to ci/jenkins_tests/multi_node_tests/many_drivers_test.py index 94eeb4715e66..585c3806103a 100644 --- a/test/jenkins_tests/multi_node_tests/many_drivers_test.py +++ b/ci/jenkins_tests/multi_node_tests/many_drivers_test.py @@ -6,8 +6,8 @@ import time import ray -from ray.test.test_utils import (_wait_for_nodes_to_join, _broadcast_event, - _wait_for_event) +from ray.tests.utils import (_wait_for_nodes_to_join, _broadcast_event, + _wait_for_event) # This test should be run with 5 nodes, which have 0, 0, 5, 6, and 50 GPUs for # a total of 61 GPUs. It should be run with a large number of drivers (e.g., diff --git a/test/jenkins_tests/multi_node_tests/remove_driver_test.py b/ci/jenkins_tests/multi_node_tests/remove_driver_test.py similarity index 98% rename from test/jenkins_tests/multi_node_tests/remove_driver_test.py rename to ci/jenkins_tests/multi_node_tests/remove_driver_test.py index 08a100670997..1cd10195b607 100644 --- a/test/jenkins_tests/multi_node_tests/remove_driver_test.py +++ b/ci/jenkins_tests/multi_node_tests/remove_driver_test.py @@ -6,8 +6,8 @@ import time import ray -from ray.test.test_utils import (_wait_for_nodes_to_join, _broadcast_event, - _wait_for_event, wait_for_pid_to_exit) +from ray.tests.utils import (_wait_for_nodes_to_join, _broadcast_event, + _wait_for_event, wait_for_pid_to_exit) # This test should be run with 5 nodes, which have 0, 1, 2, 3, and 4 GPUs for a # total of 10 GPUs. It should be run with 7 drivers. Drivers 2 through 6 must diff --git a/test/jenkins_tests/multi_node_tests/test_0.py b/ci/jenkins_tests/multi_node_tests/test_0.py similarity index 100% rename from test/jenkins_tests/multi_node_tests/test_0.py rename to ci/jenkins_tests/multi_node_tests/test_0.py diff --git a/test/jenkins_tests/multi_node_tests/test_wait_hanging.py b/ci/jenkins_tests/multi_node_tests/test_wait_hanging.py similarity index 100% rename from test/jenkins_tests/multi_node_tests/test_wait_hanging.py rename to ci/jenkins_tests/multi_node_tests/test_wait_hanging.py diff --git a/test/jenkins_tests/run_asv.sh b/ci/jenkins_tests/run_asv.sh similarity index 100% rename from test/jenkins_tests/run_asv.sh rename to ci/jenkins_tests/run_asv.sh diff --git a/test/jenkins_tests/run_multi_node_tests.sh b/ci/jenkins_tests/run_multi_node_tests.sh similarity index 100% rename from test/jenkins_tests/run_multi_node_tests.sh rename to ci/jenkins_tests/run_multi_node_tests.sh diff --git a/test/jenkins_tests/run_rllib_asv.sh b/ci/jenkins_tests/run_rllib_asv.sh similarity index 100% rename from test/jenkins_tests/run_rllib_asv.sh rename to ci/jenkins_tests/run_rllib_asv.sh diff --git a/test/stress_tests/application_cluster_template.yaml b/ci/stress_tests/application_cluster_template.yaml similarity index 100% rename from test/stress_tests/application_cluster_template.yaml rename to ci/stress_tests/application_cluster_template.yaml diff --git a/test/stress_tests/run_application_stress_tests.sh b/ci/stress_tests/run_application_stress_tests.sh similarity index 100% rename from test/stress_tests/run_application_stress_tests.sh rename to ci/stress_tests/run_application_stress_tests.sh diff --git a/test/stress_tests/run_stress_tests.sh b/ci/stress_tests/run_stress_tests.sh similarity index 100% rename from test/stress_tests/run_stress_tests.sh rename to ci/stress_tests/run_stress_tests.sh diff --git a/test/stress_tests/stress_testing_config.yaml b/ci/stress_tests/stress_testing_config.yaml similarity index 100% rename from test/stress_tests/stress_testing_config.yaml rename to ci/stress_tests/stress_testing_config.yaml diff --git a/test/stress_tests/test_dead_actors.py b/ci/stress_tests/test_dead_actors.py similarity index 100% rename from test/stress_tests/test_dead_actors.py rename to ci/stress_tests/test_dead_actors.py diff --git a/test/stress_tests/test_many_tasks_and_transfers.py b/ci/stress_tests/test_many_tasks_and_transfers.py similarity index 100% rename from test/stress_tests/test_many_tasks_and_transfers.py rename to ci/stress_tests/test_many_tasks_and_transfers.py diff --git a/.travis/bazel-format.sh b/ci/travis/bazel-format.sh similarity index 91% rename from .travis/bazel-format.sh rename to ci/travis/bazel-format.sh index ec5fa5bb0cf5..f3b4b1a9aad8 100755 --- a/.travis/bazel-format.sh +++ b/ci/travis/bazel-format.sh @@ -43,7 +43,7 @@ while [[ $# > 0 ]]; do shift done -pushd $ROOT_DIR/.. +pushd $ROOT_DIR/../.. BAZEL_FILES="bazel/BUILD bazel/BUILD.plasma bazel/ray.bzl BUILD.bazel WORKSPACE" -buildifier -mode=$RUN_TYPE -diff_command="diff -u" $BAZEL_FILES +buildifier -mode=$RUN_TYPE -diff_command="diff -u" $BAZEL_FILES popd diff --git a/.travis/check-git-clang-format-output.sh b/ci/travis/check-git-clang-format-output.sh similarity index 80% rename from .travis/check-git-clang-format-output.sh rename to ci/travis/check-git-clang-format-output.sh index 1b78e8175e6b..4d621848fdd1 100755 --- a/.travis/check-git-clang-format-output.sh +++ b/ci/travis/check-git-clang-format-output.sh @@ -8,7 +8,7 @@ else base_commit="$TRAVIS_BRANCH" echo "Running clang-format against branch $base_commit, with hash $(git rev-parse $base_commit)" fi -output="$(.travis/git-clang-format --binary clang-format-3.8 --commit $base_commit --diff --exclude '(.*thirdparty/|.*redismodule.h|.*.js)')" +output="$(ci/travis/git-clang-format --binary clang-format-3.8 --commit $base_commit --diff --exclude '(.*thirdparty/|.*redismodule.h|.*.js)')" if [ "$output" == "no modified files to format" ] || [ "$output" == "clang-format did not modify any files" ] ; then echo "clang-format passed." exit 0 diff --git a/.travis/format.sh b/ci/travis/format.sh similarity index 100% rename from .travis/format.sh rename to ci/travis/format.sh diff --git a/.travis/git-clang-format b/ci/travis/git-clang-format similarity index 100% rename from .travis/git-clang-format rename to ci/travis/git-clang-format diff --git a/.travis/install-bazel.sh b/ci/travis/install-bazel.sh similarity index 100% rename from .travis/install-bazel.sh rename to ci/travis/install-bazel.sh diff --git a/.travis/install-cython-examples.sh b/ci/travis/install-cython-examples.sh similarity index 93% rename from .travis/install-cython-examples.sh rename to ci/travis/install-cython-examples.sh index bc742c132cb6..58f44a15e102 100755 --- a/.travis/install-cython-examples.sh +++ b/ci/travis/install-cython-examples.sh @@ -7,7 +7,7 @@ ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd) echo "PYTHON is $PYTHON" -cython_examples="$ROOT_DIR/../examples/cython" +cython_examples="$ROOT_DIR/../../examples/cython" if [[ "$PYTHON" == "2.7" ]]; then diff --git a/.travis/install-dependencies.sh b/ci/travis/install-dependencies.sh similarity index 100% rename from .travis/install-dependencies.sh rename to ci/travis/install-dependencies.sh diff --git a/.travis/install-ray.sh b/ci/travis/install-ray.sh similarity index 84% rename from .travis/install-ray.sh rename to ci/travis/install-ray.sh index 28aeeef3267a..79ca25d7abae 100755 --- a/.travis/install-ray.sh +++ b/ci/travis/install-ray.sh @@ -9,21 +9,21 @@ echo "PYTHON is $PYTHON" if [[ "$PYTHON" == "2.7" ]]; then - pushd "$ROOT_DIR/../python" + pushd "$ROOT_DIR/../../python" python setup.py install --user popd elif [[ "$PYTHON" == "3.5" ]]; then export PATH="$HOME/miniconda/bin:$PATH" - pushd "$ROOT_DIR/../python" + pushd "$ROOT_DIR/../../python" python setup.py install --user popd elif [[ "$LINT" == "1" ]]; then export PATH="$HOME/miniconda/bin:$PATH" - pushd "$ROOT_DIR/../python" + pushd "$ROOT_DIR/../../python" python setup.py install --user popd diff --git a/.travis/install-with-cache-libs.sh b/ci/travis/install-with-cache-libs.sh similarity index 65% rename from .travis/install-with-cache-libs.sh rename to ci/travis/install-with-cache-libs.sh index f95a260c7e00..9758e7c89816 100755 --- a/.travis/install-with-cache-libs.sh +++ b/ci/travis/install-with-cache-libs.sh @@ -7,15 +7,15 @@ ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd) # Copy the libs to thirdparty/external_project_libs. # -n means do not build again. -bash $ROOT_DIR/../thirdparty/scripts/collect_dependent_libs.sh -n +bash $ROOT_DIR/../../thirdparty/scripts/collect_dependent_libs.sh -n # Import all the libs cached in local to environment variables. -source $ROOT_DIR/../thirdparty/external_project_libs/resource.txt +source $ROOT_DIR/../../thirdparty/external_project_libs/resource.txt # Clean the arrow building libs and use the cache libs. -pushd $ROOT_DIR/../build/external/arrow/src/arrow_ep +pushd $ROOT_DIR/../../build/external/arrow/src/arrow_ep echo "Clean Arrow building files." -rm -rf $ROOT_DIR/../build/external/arrow/src/arrow_ep-build/ +rm -rf $ROOT_DIR/../../build/external/arrow/src/arrow_ep-build/ popd # Rebuild ray with libs cache environment variables, which is fast. diff --git a/test/travis-ci/install.sh b/ci/travis/install.sh similarity index 100% rename from test/travis-ci/install.sh rename to ci/travis/install.sh diff --git a/test/travis-ci/run_test.sh b/ci/travis/run_test.sh similarity index 100% rename from test/travis-ci/run_test.sh rename to ci/travis/run_test.sh diff --git a/.travis/test-wheels.sh b/ci/travis/test-wheels.sh similarity index 85% rename from .travis/test-wheels.sh rename to ci/travis/test-wheels.sh index f7870ea52d49..1f4e97e795b5 100755 --- a/.travis/test-wheels.sh +++ b/ci/travis/test-wheels.sh @@ -21,7 +21,7 @@ else exit 1 fi -TEST_SCRIPT=$ROOT_DIR/../test/microbenchmarks.py +TEST_SCRIPT=$ROOT_DIR/../../python/ray/tests/test_microbenchmarks.py if [[ "$platform" == "linux" ]]; then # First test Python 2.7. @@ -31,7 +31,7 @@ if [[ "$platform" == "linux" ]]; then bash miniconda2.sh -b -p $HOME/miniconda2 # Find the right wheel by grepping for the Python version. - PYTHON_WHEEL=$(find $ROOT_DIR/../.whl -type f -maxdepth 1 -print | grep -m1 '27') + PYTHON_WHEEL=$(find $ROOT_DIR/../../.whl -type f -maxdepth 1 -print | grep -m1 '27') # Install the wheel. $HOME/miniconda2/bin/pip install $PYTHON_WHEEL @@ -46,7 +46,7 @@ if [[ "$platform" == "linux" ]]; then bash miniconda3.sh -b -p $HOME/miniconda3 # Find the right wheel by grepping for the Python version. - PYTHON_WHEEL=$(find $ROOT_DIR/../.whl -type f -maxdepth 1 -print | grep -m1 '36') + PYTHON_WHEEL=$(find $ROOT_DIR/../../.whl -type f -maxdepth 1 -print | grep -m1 '36') # Install the wheel. $HOME/miniconda3/bin/pip install $PYTHON_WHEEL @@ -55,7 +55,7 @@ if [[ "$platform" == "linux" ]]; then $HOME/miniconda3/bin/python $TEST_SCRIPT # Check that the other wheels are present. - NUMBER_OF_WHEELS=$(ls -1q $ROOT_DIR/../.whl/*.whl | wc -l) + NUMBER_OF_WHEELS=$(ls -1q $ROOT_DIR/../../.whl/*.whl | wc -l) if [[ "$NUMBER_OF_WHEELS" != "5" ]]; then echo "Wrong number of wheels found." ls -l $ROOT_DIR/../.whl/ @@ -84,7 +84,7 @@ elif [[ "$platform" == "macosx" ]]; then PIP_CMD="$(dirname $PYTHON_EXE)/pip$PY_MM" # Find the appropriate wheel by grepping for the Python version. - PYTHON_WHEEL=$(find $ROOT_DIR/../.whl -type f -maxdepth 1 -print | grep -m1 "$PY_WHEEL_VERSION") + PYTHON_WHEEL=$(find $ROOT_DIR/../../.whl -type f -maxdepth 1 -print | grep -m1 "$PY_WHEEL_VERSION") # Install the wheel. $PIP_CMD install $PYTHON_WHEEL diff --git a/.travis/upgrade-syn.sh b/ci/travis/upgrade-syn.sh similarity index 100% rename from .travis/upgrade-syn.sh rename to ci/travis/upgrade-syn.sh diff --git a/python/ray/rllib/train.py b/python/ray/rllib/train.py index 3b043e1a944f..d08f7ef14a37 100755 --- a/python/ray/rllib/train.py +++ b/python/ray/rllib/train.py @@ -8,7 +8,7 @@ import yaml import ray -from ray.test.cluster_utils import Cluster +from ray.tests.cluster_utils import Cluster from ray.tune.config_parser import make_parser from ray.tune.trial import resources_to_json from ray.tune.tune import _make_scheduler, run_experiments diff --git a/python/ray/test/__init__.py b/python/ray/tests/__init__.py similarity index 100% rename from python/ray/test/__init__.py rename to python/ray/tests/__init__.py diff --git a/python/ray/test/cluster_utils.py b/python/ray/tests/cluster_utils.py similarity index 100% rename from python/ray/test/cluster_utils.py rename to python/ray/tests/cluster_utils.py diff --git a/test/actor_test.py b/python/ray/tests/test_actor.py similarity index 99% rename from test/actor_test.py rename to python/ray/tests/test_actor.py index 16642540c117..fd5ce7bfbc57 100644 --- a/test/actor_test.py +++ b/python/ray/tests/test_actor.py @@ -14,8 +14,8 @@ import ray import ray.ray_constants as ray_constants -import ray.test.test_utils -import ray.test.cluster_utils +import ray.tests.utils +import ray.tests.cluster_utils @pytest.fixture @@ -44,7 +44,7 @@ def shutdown_only(): @pytest.fixture() def ray_start_cluster(): - cluster = ray.test.cluster_utils.Cluster() + cluster = ray.tests.cluster_utils.Cluster() yield cluster # The code after the yield will run as teardown code. @@ -58,7 +58,7 @@ def two_node_cluster(): "initial_reconstruction_timeout_milliseconds": 200, "num_heartbeats_timeout": 10, }) - cluster = ray.test.cluster_utils.Cluster() + cluster = ray.tests.cluster_utils.Cluster() for _ in range(2): remote_node = cluster.add_node( num_cpus=1, _internal_config=internal_config) @@ -73,7 +73,7 @@ def two_node_cluster(): @pytest.fixture def head_node_cluster(request): timeout = getattr(request, "param", 200) - cluster = ray.test.cluster_utils.Cluster( + cluster = ray.tests.cluster_utils.Cluster( initialize_head=True, connect=True, head_node_args={ @@ -418,7 +418,7 @@ def __init__(self): assert len(actor_keys) == 1 actor_class_info = r.hgetall(actor_keys[0]) assert actor_class_info[b"class_name"] == b"Foo" - assert actor_class_info[b"module"] == b"actor_test" + assert actor_class_info[b"module"] == b"ray.tests.test_actor" def test_multiple_return_values(ray_start_regular): @@ -483,13 +483,13 @@ def getpid(self): a = Actor.remote() pid = ray.get(a.getpid.remote()) a = None - ray.test.test_utils.wait_for_pid_to_exit(pid) + ray.tests.utils.wait_for_pid_to_exit(pid) actors = [Actor.remote() for _ in range(10)] pids = ray.get([a.getpid.remote() for a in actors]) a = None actors = None - [ray.test.test_utils.wait_for_pid_to_exit(pid) for pid in pids] + [ray.tests.utils.wait_for_pid_to_exit(pid) for pid in pids] @ray.remote class Actor(object): diff --git a/test/array_test.py b/python/ray/tests/test_array.py similarity index 99% rename from test/array_test.py rename to python/ray/tests/test_array.py index 7ed73811991d..1ddd9d45c69a 100644 --- a/test/array_test.py +++ b/python/ray/tests/test_array.py @@ -10,7 +10,7 @@ import ray import ray.experimental.array.remote as ra import ray.experimental.array.distributed as da -import ray.test.cluster_utils +import ray.tests.cluster_utils if sys.version_info >= (3, 0): from importlib import reload @@ -75,7 +75,7 @@ def ray_start_two_nodes(): ]: reload(module) # Start the Ray processes. - cluster = ray.test.cluster_utils.Cluster() + cluster = ray.tests.cluster_utils.Cluster() for _ in range(2): cluster.add_node(num_cpus=10) ray.init(redis_address=cluster.redis_address) diff --git a/test/autoscaler_test.py b/python/ray/tests/test_autoscaler.py similarity index 100% rename from test/autoscaler_test.py rename to python/ray/tests/test_autoscaler.py diff --git a/test/runtest.py b/python/ray/tests/test_basic.py similarity index 99% rename from test/runtest.py rename to python/ray/tests/test_basic.py index 1ad95233bc52..370dfc018809 100644 --- a/test/runtest.py +++ b/python/ray/tests/test_basic.py @@ -25,8 +25,8 @@ import pytest import ray -import ray.test.cluster_utils -import ray.test.test_utils +import ray.tests.cluster_utils +import ray.tests.utils from ray.utils import _random_string logger = logging.getLogger(__name__) @@ -1139,7 +1139,7 @@ def f(): @pytest.fixture() def ray_start_cluster(): - cluster = ray.test.cluster_utils.Cluster() + cluster = ray.tests.cluster_utils.Cluster() yield cluster # The code after the yield will run as teardown code. @@ -2281,7 +2281,7 @@ def f(): return os.getpid() pid = ray.get(f.remote()) - ray.test.test_utils.wait_for_pid_to_exit(pid) + ray.tests.utils.wait_for_pid_to_exit(pid) @ray.remote(max_calls=2) def f(): @@ -2290,7 +2290,7 @@ def f(): pid1 = ray.get(f.remote()) pid2 = ray.get(f.remote()) assert pid1 == pid2 - ray.test.test_utils.wait_for_pid_to_exit(pid1) + ray.tests.utils.wait_for_pid_to_exit(pid1) def attempt_to_load_balance(remote_function, @@ -2443,9 +2443,9 @@ def f(*xs): assert task_spec["DriverID"] == driver_id assert task_spec["ReturnObjectIDs"] == [result_id] function_table_entry = function_table[task_spec["FunctionID"]] - assert function_table_entry["Name"] == "runtest.f" + assert function_table_entry["Name"] == "ray.tests.test_basic.f" assert function_table_entry["DriverID"] == driver_id - assert function_table_entry["Module"] == "runtest" + assert function_table_entry["Module"] == "ray.tests.test_basic" assert task_table[task_id] == ray.global_state.task_table(task_id) @@ -2722,7 +2722,8 @@ def f(self): @ray.remote def unique_1(): - assert setproctitle.getproctitle() == "ray_worker:runtest.unique_1()" + assert setproctitle.getproctitle( + ) == "ray_worker:ray.tests.test_basic.unique_1()" actor = UniqueName.remote() ray.get(actor.f.remote()) diff --git a/test/component_failures_test.py b/python/ray/tests/test_component_failures.py similarity index 99% rename from test/component_failures_test.py rename to python/ray/tests/test_component_failures.py index 6279f258b6c9..4d9bbd80d5e7 100644 --- a/test/component_failures_test.py +++ b/python/ray/tests/test_component_failures.py @@ -13,8 +13,8 @@ import ray import ray.ray_constants as ray_constants -from ray.test.cluster_utils import Cluster -from ray.test.test_utils import run_string_as_driver_nonblocking +from ray.tests.cluster_utils import Cluster +from ray.tests.utils import run_string_as_driver_nonblocking @pytest.fixture diff --git a/test/credis_test.py b/python/ray/tests/test_credis.py similarity index 100% rename from test/credis_test.py rename to python/ray/tests/test_credis.py diff --git a/test/cython_test.py b/python/ray/tests/test_cython.py similarity index 100% rename from test/cython_test.py rename to python/ray/tests/test_cython.py diff --git a/test/debug_tools_test.py b/python/ray/tests/test_debug_tools.py similarity index 100% rename from test/debug_tools_test.py rename to python/ray/tests/test_debug_tools.py diff --git a/test/failure_test.py b/python/ray/tests/test_failure.py similarity index 99% rename from test/failure_test.py rename to python/ray/tests/test_failure.py index 543cb714060a..19dfbbc6cb45 100644 --- a/test/failure_test.py +++ b/python/ray/tests/test_failure.py @@ -16,7 +16,7 @@ import ray import ray.ray_constants as ray_constants from ray.utils import _random_string -from ray.test.cluster_utils import Cluster +from ray.tests.cluster_utils import Cluster def relevant_errors(error_type): diff --git a/python/ray/test/test_global_state.py b/python/ray/tests/test_global_state.py similarity index 98% rename from python/ray/test/test_global_state.py rename to python/ray/tests/test_global_state.py index 0a627ca03b1f..11920a21c6a4 100644 --- a/python/ray/test/test_global_state.py +++ b/python/ray/tests/test_global_state.py @@ -11,7 +11,7 @@ import time import ray -from ray.test.cluster_utils import Cluster +from ray.tests.cluster_utils import Cluster @pytest.fixture diff --git a/test/microbenchmarks.py b/python/ray/tests/test_microbenchmarks.py similarity index 100% rename from test/microbenchmarks.py rename to python/ray/tests/test_microbenchmarks.py diff --git a/test/mini_test.py b/python/ray/tests/test_mini.py similarity index 100% rename from test/mini_test.py rename to python/ray/tests/test_mini.py diff --git a/python/ray/test/test_modin.py b/python/ray/tests/test_modin.py similarity index 100% rename from python/ray/test/test_modin.py rename to python/ray/tests/test_modin.py diff --git a/test/monitor_test.py b/python/ray/tests/test_monitors.py similarity index 98% rename from test/monitor_test.py rename to python/ray/tests/test_monitors.py index 248aa6fb0e31..486d8ca022ae 100644 --- a/test/monitor_test.py +++ b/python/ray/tests/test_monitors.py @@ -10,7 +10,7 @@ import ray -from ray.test.test_utils import run_and_get_output +from ray.tests.utils import run_and_get_output def _test_cleanup_on_driver_exit(num_redis_shards): diff --git a/test/multi_node_test.py b/python/ray/tests/test_multi_node.py similarity index 98% rename from test/multi_node_test.py rename to python/ray/tests/test_multi_node.py index 239789d13e50..719e473808e5 100644 --- a/test/multi_node_test.py +++ b/python/ray/tests/test_multi_node.py @@ -8,8 +8,8 @@ import time import ray -from ray.test.test_utils import (run_and_get_output, run_string_as_driver, - run_string_as_driver_nonblocking) +from ray.tests.utils import (run_and_get_output, run_string_as_driver, + run_string_as_driver_nonblocking) @pytest.fixture diff --git a/test/multi_node_test_2.py b/python/ray/tests/test_multi_node_2.py similarity index 98% rename from test/multi_node_test_2.py rename to python/ray/tests/test_multi_node_2.py index 20a9b6d000b4..28e93050c535 100644 --- a/test/multi_node_test_2.py +++ b/python/ray/tests/test_multi_node_2.py @@ -9,7 +9,7 @@ import ray import ray.ray_constants as ray_constants -from ray.test.cluster_utils import Cluster +from ray.tests.cluster_utils import Cluster logger = logging.getLogger(__name__) diff --git a/test/node_manager_test.py b/python/ray/tests/test_node_manager.py similarity index 94% rename from test/node_manager_test.py rename to python/ray/tests/test_node_manager.py index 2f18d7b7308e..5a6b71f18fad 100644 --- a/test/node_manager_test.py +++ b/python/ray/tests/test_node_manager.py @@ -5,8 +5,8 @@ import pytest import ray -from ray.test.cluster_utils import Cluster -from ray.test.test_utils import run_string_as_driver +from ray.tests.cluster_utils import Cluster +from ray.tests.utils import run_string_as_driver @pytest.fixture() diff --git a/test/object_manager_test.py b/python/ray/tests/test_object_manager.py similarity index 99% rename from test/object_manager_test.py rename to python/ray/tests/test_object_manager.py index b51f54d1a803..757be18979a3 100644 --- a/test/object_manager_test.py +++ b/python/ray/tests/test_object_manager.py @@ -11,7 +11,7 @@ import warnings import ray -from ray.test.cluster_utils import Cluster +from ray.tests.cluster_utils import Cluster if (multiprocessing.cpu_count() < 40 or ray.utils.get_system_memory() < 50 * 10**9): diff --git a/python/ray/test/test_queue.py b/python/ray/tests/test_queue.py similarity index 100% rename from python/ray/test/test_queue.py rename to python/ray/tests/test_queue.py diff --git a/python/ray/test/test_ray_init.py b/python/ray/tests/test_ray_init.py similarity index 97% rename from python/ray/test/test_ray_init.py rename to python/ray/tests/test_ray_init.py index 2b17ce35ef28..ef50b013077a 100644 --- a/python/ray/test/test_ray_init.py +++ b/python/ray/tests/test_ray_init.py @@ -7,7 +7,7 @@ import redis import ray -from ray.test.cluster_utils import Cluster +from ray.tests.cluster_utils import Cluster @pytest.fixture diff --git a/test/recursion_test.py b/python/ray/tests/test_recursion.py similarity index 74% rename from test/recursion_test.py rename to python/ray/tests/test_recursion.py index c3f7db59af03..0b3b68351cee 100644 --- a/test/recursion_test.py +++ b/python/ray/tests/test_recursion.py @@ -6,9 +6,21 @@ from __future__ import division from __future__ import print_function +import pytest + import ray -ray.init(num_cpus=1) + +@pytest.fixture +def ray_start(): + # Start ray instance + ray.init(num_cpus=1) + + # Run test using this fixture + yield None + + # Shutdown ray instance + ray.shutdown() @ray.remote @@ -18,7 +30,7 @@ def factorial(n): return n * ray.get(factorial.remote(n - 1)) -def test_recursion(): +def test_recursion(ray_start): assert ray.get(factorial.remote(0)) == 1 assert ray.get(factorial.remote(1)) == 1 assert ray.get(factorial.remote(2)) == 2 diff --git a/test/test_signal.py b/python/ray/tests/test_signal.py similarity index 100% rename from test/test_signal.py rename to python/ray/tests/test_signal.py diff --git a/test/stress_tests.py b/python/ray/tests/test_stress.py similarity index 99% rename from test/stress_tests.py rename to python/ray/tests/test_stress.py index 0cf712a1a93d..cdb5684e30cb 100644 --- a/test/stress_tests.py +++ b/python/ray/tests/test_stress.py @@ -9,7 +9,7 @@ import time import ray -from ray.test.cluster_utils import Cluster +from ray.tests.cluster_utils import Cluster import ray.ray_constants as ray_constants diff --git a/test/tempfile_test.py b/python/ray/tests/test_tempfile.py similarity index 100% rename from test/tempfile_test.py rename to python/ray/tests/test_tempfile.py diff --git a/test/tensorflow_test.py b/python/ray/tests/test_tensorflow.py similarity index 100% rename from test/tensorflow_test.py rename to python/ray/tests/test_tensorflow.py diff --git a/python/ray/test/test_utils.py b/python/ray/tests/utils.py similarity index 100% rename from python/ray/test/test_utils.py rename to python/ray/tests/utils.py diff --git a/python/ray/tune/test/cluster_tests.py b/python/ray/tune/test/cluster_tests.py index 05a597e06e11..96a66dbef6a6 100644 --- a/python/ray/tune/test/cluster_tests.py +++ b/python/ray/tune/test/cluster_tests.py @@ -16,8 +16,8 @@ import ray from ray import tune from ray.rllib import _register_all -from ray.test.cluster_utils import Cluster -from ray.test.test_utils import run_string_as_driver_nonblocking +from ray.tests.cluster_utils import Cluster +from ray.tests.utils import run_string_as_driver_nonblocking from ray.tune.error import TuneError from ray.tune.experiment import Experiment from ray.tune.trial import Trial