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

ENH: Add pytest cli options and ini configurations #70

Closed
wants to merge 5 commits into from

Conversation

Sheila-nk
Copy link
Collaborator

@Sheila-nk Sheila-nk commented Jul 18, 2023

  • Implemented the pytest_addoption hook function to register custom cli options and ini configurations
  • Updated pyproject.toml file with dependencies and plugin entry-point
  • You can now use cli command --doctest-scpdt when running pytest to enable doctesting through the scpdt tool

TODO:

  • Bug: doctests for *.rst files are currently being collected twice on running:
    python -m pytest scpdt/tests --doctest-scpdt --doctest-glob='*.rst'
  • Discuss custom cli options and ini configurations for scpdt

Closes #67

@Sheila-nk
Copy link
Collaborator Author

@ev-br
So I added the --doctest-scpdt cli option that is meant to enable doctests using the scpdt tool and --doctest-only cli option that is meant to ensure only doctests are carried out.
I also added the doctest_options ini configuration that specifies the default doctest options for the scpdt tool.
I don't think I have exhausted the cli options and configurations, that's why I made this a draft PR instead so we can have a discussion about amending or adding to the list.
My main point of confusion is what attributes and configurations we should set using the hooks and what we should let DTConfig take care of.

@Sheila-nk
Copy link
Collaborator Author

After changing the pytest_configure hook to override doctest functions and classes when the cli command --doctest-scpdt is used or when the doctest_scpdt ini option is True, I don't think there's need to implement the pytest_collect_files hook since the test collectors have already been overridden.

@Sheila-nk
Copy link
Collaborator Author

I don't think there's need to implement the pytest_collect_files hook since the test collectors have already been overridden.

I take this back, without the pytest_collect_file hook, all doctests are not being collected. Lol!

@Sheila-nk Sheila-nk marked this pull request as ready for review July 28, 2023 15:10
@Sheila-nk Sheila-nk marked this pull request as draft July 28, 2023 15:14
@Sheila-nk
Copy link
Collaborator Author

I believe we can close this PR now since it is a duplicate of @ev-br's merged PR: #128 which implements the pytest_addoption hook function to register custom cli options.
Also, all doctests are being collected without the implementation of the pytest_collect_file hook.

@Sheila-nk Sheila-nk closed this May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define command line options and configuration settings for doctests
1 participant