Skip to content

Conversation

@pp-mo
Copy link
Owner

@pp-mo pp-mo commented Oct 16, 2025

Pursuing an idea that we might create a better test-runner than pytest, for ourselves

@pp-mo pp-mo force-pushed the pytestless_doctests branch from 8e46cb3 to fd9a1ca Compare October 20, 2025 09:03
@pp-mo pp-mo force-pushed the pytestless_doctests branch from f4a4ab4 to d1b7213 Compare October 21, 2025 09:33
@pp-mo pp-mo force-pushed the pytestless_doctests branch from ef86558 to 506dc26 Compare October 21, 2025 10:06
@pp-mo pp-mo changed the base branch from main to update_devdocs October 21, 2025 10:17
@pp-mo pp-mo force-pushed the pytestless_doctests branch 3 times, most recently from a7ece14 to 96ef52c Compare October 22, 2025 12:47
@pp-mo pp-mo force-pushed the pytestless_doctests branch from 3f4b3b4 to 6e27328 Compare October 22, 2025 12:50
) -> list[Path]:
"""Expand globs to a list of filepaths.

Also filter with exclude controls.
Copy link
Owner Author

@pp-mo pp-mo Oct 29, 2025

Choose a reason for hiding this comment

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

I think the "private" concept does not apply to documentation files : Explain this?

"""
actual_paths: list[Path] = []
segments = file_path.split("/")
i_wilds = [
Copy link
Owner Author

Choose a reason for hiding this comment

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

TODO: document the intention.

In order to resolve a globbed path like dir/subdir/**/*AB_test.extension, we need to split the root path of the search from the wildcarded parts, to do Path("dir/subdir").glob("**/*AB_test.extension")
So here we are finding which path segments contain glob characters, and splitting at the first of those.
This probably is still a bit crude

  • e.g. can't handle escaped glob chars
  • e.g. maybe doesn't work (needs testing) if the globbed part or unglobbed parts are empty

Copy link
Owner Author

Choose a reason for hiding this comment

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

update:
After some reading, possibly what is really wanted here can be done with a simple glob recursive=True ?
See https://stackoverflow.com/a/57644936/2615050

Best I think would be to first get tests working for complicated cases, as is, then show that the simple glob solution works!

@pp-mo
Copy link
Owner Author

pp-mo commented Nov 5, 2025

What is still missing?

Apart from the above, this is still only "trial code".
Intention is (for now) to not put this in a distributable package, but into a SciTools template

What's really driving that is a desire to use this for Iris too.

Probably, it would still be good to have a distinct repo, for central control + to host testing,
- but that would also follow the template
(or perhaps, ~equivalently, the template follows the primary repo)

What's I can already see is still missing with the function itself ..

  • now complicated enough that it needs some tests
  • possible problems with less usual glob forms (in include/target specs) -- see above
    • ideally, do the glob thing properly (e.g. support '**' -- but don't know of a 'standard' implementation for that)
  • support proper globs in exclude patterns ?
  • lack of global options config
    • possibly should exist in pyproject.toml
    • make it look like a real tool
    • this would seem especially useful for excludes

try:
name, val = setting_str.split("=")

# Detect + translate numeric and boolean values.
Copy link
Owner Author

@pp-mo pp-mo Jan 5, 2026

Choose a reason for hiding this comment

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

"numeric" here should probably say "integer".
Floats etc not needed for anything in these functions

def process_options(
opt_str: str, paths_are_modules: bool = True
) -> dict[str, str]:
"""Convert the "-o/--options" arg into a **kwargs for the doctest function call."""
Copy link
Owner Author

Choose a reason for hiding this comment

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

Perhaps worth making the point here that we are 'interpreting' the input to avoid using "exec", on general principles (!)

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.

2 participants