Skip to content
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

[CI] Migrate from sphinx.ext.doctest to pytest-sphinx #35286

Merged
merged 102 commits into from
May 30, 2023

Conversation

bveeramani
Copy link
Member

@bveeramani bveeramani commented May 12, 2023

Stacked on:

Why are these changes needed?

This PR switches our doctest tooling from sphinx.ext.doctest to pytest-sphinx.

Context
We want to test all code snippets in CI.

testcode and doctest examples are tested in CI with sphinx.ext.doctest. But, we often write code-block:: python examples, and they aren't tested in CI.

Problem
sphinx.ext.doctest doesn't let you test specific files. As a result, it's hard to update examples or isolate GPU examples.

Solution
Migrate to pytest-sphinx. Two reasons:

  1. Lets us run GPU doctests
  2. Enables developers to quickly test their examples

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

bveeramani and others added 30 commits November 21, 2022 21:00
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
This reverts commit de05655.

Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
@bveeramani bveeramani requested a review from matthewdeng as a code owner May 26, 2023 18:28
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
@@ -85,7 +85,7 @@ def train_loop_per_worker():

Example:

.. code-block:: python
.. testcode::
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need at least one GPU test, or else Bazel fails and complains that no tests were found.

@@ -61,6 +61,29 @@
# these tests in n different jobs.

load("//bazel:python.bzl", "py_test_module_list")
load("//bazel:python.bzl", "doctest")

# TODO(@bveeramani): Enable doctests.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RLLib has many failing doctests. Since it'll take a while to address those, I'd like to enable doctests for RLLib in a follow-up PR.

Copy link
Collaborator

@can-anyscale can-anyscale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bazel/python.bzl Outdated Show resolved Hide resolved
ci/ci.sh Show resolved Hide resolved
python/ray/train/torch/torch_detection_predictor.py Outdated Show resolved Hide resolved
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Copy link
Contributor

@richardliaw richardliaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stamp for docs, also cc @can-anyscale for vis

Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Copy link
Contributor

@fishbone fishbone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stamp by asking. i never review this.

@bveeramani bveeramani added the tests-ok The tagger certifies test failures are unrelated and assumes personal liability. label May 27, 2023
@amogkam amogkam merged commit d4a8900 into ray-project:master May 30, 2023
@amogkam
Copy link
Contributor

amogkam commented May 30, 2023

nice work!

ericl pushed a commit that referenced this pull request May 31, 2023
#35286 broke CI. These issues weren't caught earlier because the PR was out of date with master.
amogkam pushed a commit that referenced this pull request Jun 9, 2023
#35286 temporarily disabled doctests for RLLib because there are many broken and (previously) untested docstring examples. This PR re-enables them.

---------

Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Artur Niederfahrenhorst <attaismyname@googlemail.com>
Co-authored-by: Artur Niederfahrenhorst <attaismyname@googlemail.com>
scv119 pushed a commit to scv119/ray that referenced this pull request Jun 16, 2023
…t#35286)

This PR switches our doctest tooling from sphinx.ext.doctest to pytest-sphinx.

Context
We want to test all code snippets in CI.

testcode and doctest examples are tested in CI with sphinx.ext.doctest. But, we often write code-block:: python examples, and they aren't tested in CI.

Problem
sphinx.ext.doctest doesn't let you test specific files. As a result, it's hard to update examples or isolate GPU examples.

Solution
Migrate to pytest-sphinx. Two reasons:

Lets us run GPU doctests
Enables developers to quickly test their examples

---------

Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
scv119 pushed a commit to scv119/ray that referenced this pull request Jun 16, 2023
ray-project#35286 broke CI. These issues weren't caught earlier because the PR was out of date with master.
arvind-chandra pushed a commit to lmco/ray that referenced this pull request Aug 31, 2023
…t#35286)

This PR switches our doctest tooling from sphinx.ext.doctest to pytest-sphinx.

Context
We want to test all code snippets in CI.

testcode and doctest examples are tested in CI with sphinx.ext.doctest. But, we often write code-block:: python examples, and they aren't tested in CI.

Problem
sphinx.ext.doctest doesn't let you test specific files. As a result, it's hard to update examples or isolate GPU examples.

Solution
Migrate to pytest-sphinx. Two reasons:

Lets us run GPU doctests
Enables developers to quickly test their examples

---------

Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: e428265 <arvind.chandramouli@lmco.com>
arvind-chandra pushed a commit to lmco/ray that referenced this pull request Aug 31, 2023
ray-project#35286 broke CI. These issues weren't caught earlier because the PR was out of date with master.
Signed-off-by: e428265 <arvind.chandramouli@lmco.com>
arvind-chandra pushed a commit to lmco/ray that referenced this pull request Aug 31, 2023
ray-project#35286 temporarily disabled doctests for RLLib because there are many broken and (previously) untested docstring examples. This PR re-enables them.

---------

Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Artur Niederfahrenhorst <attaismyname@googlemail.com>
Co-authored-by: Artur Niederfahrenhorst <attaismyname@googlemail.com>
Signed-off-by: e428265 <arvind.chandramouli@lmco.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests-ok The tagger certifies test failures are unrelated and assumes personal liability.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants