-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-16018: [Doc][Python] Run doctests on Python docstring examples (--doctest-modules) #13199
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
Conversation
|
|
|
There are some examples I removed from |
|
@raulcd @jorisvandenbossche the code now works for |
|
Hi @AlenkaF creating a new job sounds good to me. I have checked out your PR locally and there are a couple of things that are not clear to me. If I try to run tests locally with the current setup This is because the new conftest skips collecting tests if we are using I also have been able to reproduce the same appveyor failure if I remove the new conftest file, we might require some more investigation: I would propose to not add |
|
Thanks @raulcd for reviewing and testing locally! For the first issue: For the second issue. The errors that you get when removing newly added conftest file are due to the fact that doctest collects all the .py files from pyarrow to run doctest on. Because some modules were not build (in you case cuda for example) doctest complains. For this reason new conftest file was added, to check which modules are not installed and tell doctest to skip the files that are connected to this missing modules. The issue was solved by removing |
|
Thanks for helping me understand your comment better Raul and sorry for not seeing the problem! Now I get what Joris was trying to tell me yesterday also :) Yes, tests are totally being skipped due to this change and that's not good at all. I will remove |
jorisvandenbossche
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should maybe see if it would be possible to de-duplicate the groups/defaults definitions in both conftest.py files (I suppose that if all of them are defined in the top-level conftest.py, that should be fine for the tests as well)
python/pyarrow/conftest.py
Outdated
|
|
||
| try: | ||
| from pyarrow.fs import S3FileSystem # noqa | ||
| defaults['fs'] = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there S3 examples in fs.py?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is just one (line)
Line 227 in d4a7638
| >>> copy_files("s3://your-bucket-name", "local-directory") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realised I will have to check these examples also (as they do not get checked locally for me at the moment).
Yes, that sounds good. Although I think you can maybe do the CI job one before tackling the cython doctests; in that way we can directly test it in CI in the cython PR. |
|
I will do the CI one today and then we can decide which PR to close first =) |
jorisvandenbossche
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a pass through the doctest changes and added a few comments.
Further, I think we should still take a look whether we can deduplicate some content of the conftest.py files:
We should maybe see if it would be possible to de-duplicate the
groups/defaultsdefinitions in both conftest.py files (I suppose that if all of them are defined in the top-level conftest.py, that should be fine for the tests as well)
Yes, totally agree. Had it in mind. There is some small differences but I will try to put the code for groups/defaults definitions together in the top level (pyarrow) conftest.py file and leave the rest as is. I will also check other comments and make changes. Thanks for reviewing! |
|
|
||
|
|
||
| # Save output files from doctest examples into temp dir | ||
| @pytest.fixture(autouse=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a follow-up, it might be possible use a dynamic scope to ensure we don't have to run this for every test in /tests (in case that adds runtime to our tests).
Or alternatively, we would also override this fixture in /tests/conftest.py to be a no-op fixture, and then all tests in /tests should automatically use that version of the fixture.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran it with and without this fixture on test_arrays.py, and it doesn't give a noticeable difference, so probably not worth looking into making this "smarter" with a dynamic scope.
jorisvandenbossche
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some minor comments, but maybe (since this is now green) we can also merge this and you can address those comments in #13216 ?
|
Thanks! I would address the comments in this PR. |
|
If the checks pass, this should be ready to merge @jorisvandenbossche. |
|
Benchmark runs are scheduled for baseline = fe2ce20 and contender = 3b92f02. 3b92f02 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
A series of 3 PRs add
doctestfunctionality to ensure that docstring examples are actually correct (and keep being correct).--doctest-module--doctest-cythonARROW-16018: [Doc][Python] Run doctests on Python docstring examples (--doctest-cython) #13204This PR can be tested with
pytest --doctest-modules python/pyarrow.