Skip to content

192 update tests python - #201

Open
rmarow wants to merge 11 commits into
feat-helm-46-minio-to-s3from
192-update-tests-python
Open

rmarow wants to merge 11 commits into
feat-helm-46-minio-to-s3from
192-update-tests-python

Conversation

@rmarow

@rmarow rmarow commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Resolves #192

  • Adds Python 3.13 and 3.14 to the CI test matrix and package classifiers
  • Adds 3.15 to the CI test matrix (it's still pre-release, so no classifier yet)
  • Adds a pytest filter for a SyntaxWarning in d1_common that breaks test collection on 3.14+
    3.11 and 3.12 are still supported and tested. The story mentions optionally dropping them since they're security-only, but I left that for a separate decision.

The d1_common issue

On 3.14+, every unit test failed at collection with:

SyntaxError: "\s" is an invalid escape sequence

This comes from a non-raw regex string in d1_common/xml.py (dataone.libclient). Python emits it as a SyntaxWarning, but our filterwarnings = ["error"] setting escalates it to an error. 3.14 also reworded the warning message, which is why the filter uses a leading .*.

The real fix is a one-character change upstream in d1_python (b"..." → rb"..."). Worth doing eventually, since a future Python will turn this into an actual error and no filter will help then.

Testing

Ran typecheck and test_unit locally on each version:

@trey-stafford trey-stafford left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The story mentions optionally dropping them since they're security-only, but I left that for a separate decision.

This could be a follow-on PR. It would be nice to update the min. Python to v3.13 (or even 3.14!). That would also require updating the mypy and ruff config to point at that min version as the target (e.g., too.mypy's python_version in pyproject.yaml). Probably not our biggest priority right now, but if it's easy enough to pull things forward I'd say go for it.

@rmarow

rmarow commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

@trey-stafford could you take another look? I went ahead with your recommendation of updating the min. Python to v3.13

@trey-stafford
trey-stafford self-requested a review November 17, 2026 00:14

@trey-stafford trey-stafford left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the latest changes inadvertently added the filterwarning for root_path, which was removed. Otherwise I think this looks good!

Comment thread pyproject.toml Outdated
# FastAPI deprecates `FastAPI(root_path=...)` (seen in 0.162). The app still
# needs it to honor API_ROOT_PATH, so ignore the warning rather than change
# routing. Category is UserWarning because FastAPIDeprecationWarning subclasses it.
"ignore:The `root_path` parameter is deprecated:UserWarning",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should be able to remove the root path warning.


# Create a FastAPI dependency on the database session.
def _get_session() -> Generator[Session, None, None]:
def _get_session() -> Generator[Session]:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice - this is much clearer to me because I always have to refresh my memory on what the other two arguments are for, and why None is given.

WorkflowTask: TypeAlias = Any
WorkflowScript: TypeAlias = Callable[..., WorkflowTask]
WorkflowTask = Any
WorkflowScript = Callable[..., WorkflowTask]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Did you try using the type keyword here? e.g., type WorkflowScript = Callable[..., WorkflowTask]? I think using that or TypeAlias is a little more explicit, although dropping clearly works. Was this something mypy or ruff caught?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes this was caught by ruff

This branch has not been deployed

No deployments
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