Skip to content

Commit

Permalink
[docs] Fix pytest and add stacklevel (ray-project#26340)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardliaw committed Jul 12, 2022
1 parent 1de0d35 commit 191921f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions doc/source/ray-contribute/getting-involved.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,15 @@ The full suite of tests is too large to run on a single machine. However, you ca

.. code-block:: shell
pytest -v -s python/ray/tests/test_basic.py
# Directly calling `pytest -v ...` may lose import paths.
python -m pytest -v -s python/ray/tests/test_basic.py
This will run all of the tests in the file. To run a specific test, use the following:

.. code-block:: shell
pytest -v -s test_file.py::name_of_the_test
# Directly calling `pytest -v ...` may lose import paths.
python -m pytest -v -s test_file.py::name_of_the_test
Testing for C++ development
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
6 changes: 3 additions & 3 deletions python/ray/tune/_structure_refactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ def warn_structure_refactor(old_module: str, new_module: str, direct: bool = Tru

if direct:
warning += (
f"Example: Do a global search and "
f" Example: Do a global search and "
f"replace `{old_module}` with `{new_module}`."
)

else:
warning += (
f"ATTENTION: This module may have been split or refactored. Please "
f"\nATTENTION: This module may have been split or refactored. Please "
f"check the contents of `{new_module}` before making changes."
)

with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(warning, DeprecationWarning)
warnings.warn(warning, DeprecationWarning, stacklevel=3)

0 comments on commit 191921f

Please sign in to comment.