Skip to content

rename test files#554

Merged
KevinShuman merged 6 commits intomainfrom
show-tests-vscode
May 27, 2025
Merged

rename test files#554
KevinShuman merged 6 commits intomainfrom
show-tests-vscode

Conversation

@philippemiron
Copy link
Copy Markdown
Contributor

Fix #511 for me.

I'm using uv to create the environment (uv sync --extra all) and my vscode/settings.json is:

{
    "python.defaultInterpreterPath": "./.venv/bin/python",
    "python.testing.pytestArgs": [
        "tests"
    ],
    "python.testing.unittestEnabled": false,
    "python.testing.pytestEnabled": true,
    "editor.formatOnSave": true,
    "[python]": {
        "editor.defaultFormatter": "charliermarsh.ruff",
    }
}

Hopefully, it works with conda too, but someone should confirmed.

@selipot
Copy link
Copy Markdown
Member

selipot commented May 20, 2025

What uv? A new environment management solution?

@selipot
Copy link
Copy Markdown
Member

selipot commented May 20, 2025

I just had another look: I have tests running again in vs code, see screenshot. My json setting file is as below. Can someone remind me if we are using pytest or unittest?

{
    "git.confirmSync": false,
    "git.autofetch": true,
    "terminal.integrated.inheritEnv": false,
    "[python]": {
        "editor.formatOnType": true
    },
    "jupyter.interactiveWindow.creationMode": "perFile",
    "githubPullRequests.pullBranch": "never",
    "notebook.output.scrolling": true,
    "githubPullRequests.fileListLayout": "tree",
    "security.workspace.trust.untrustedFiles": "open",
    "window.autoDetectColorScheme": true,
    "terminal.integrated.enableMultiLinePasteWarning": false,
    "explorer.confirmDelete": false,
    "workbench.colorTheme": "Default Light Modern",
    "python.testing.pytestEnabled": true,
    "interactiveWindow.executeWithShiftEnter": false,
    "jupyter.interactiveWindow.textEditor.executeSelection": true,
    "jupyter.widgetScriptSources": [
        "jsdelivr.com",
        "unpkg.com"
    ]
}
Screenshot 2025-05-20 at 10 23 00 AM

@selipot
Copy link
Copy Markdown
Member

selipot commented May 20, 2025

The tests that failed in my case were re-run and passed after regenerating my local andro and glad datasets

@selipot
Copy link
Copy Markdown
Member

selipot commented May 20, 2025

@philippemiron this seems to run in VS Code for me, see screenshot. What is this setting doing?

    "python.testing.pytestArgs": [
        "tests"
    ],
Screenshot 2025-05-20 at 12 05 07 PM

@philippemiron
Copy link
Copy Markdown
Contributor Author

philippemiron commented May 20, 2025

It just specify the folders of the tests (it's running pytest tests/), which is tests/ by default so shouldn't make a difference.

@philippemiron this seems to run in VS Code for me, see screenshot. What is this setting doing?

    "python.testing.pytestArgs": [
        "tests"
    ],
Screenshot 2025-05-20 at 12 05 07 PM

@philippemiron
Copy link
Copy Markdown
Contributor Author

What uv? A new environment management solution?

It is! It has many advantages. Would be easier to zoom to talk about it if you want more info. It's from the same people at Astral that built ruff.

https://github.com/astral-sh/uv

@selipot
Copy link
Copy Markdown
Member

selipot commented May 20, 2025

This looks good to me. Not sure wht the Lint/mypy test is failing?

@selipot selipot added the bug Something isn't working label May 20, 2025
@selipot selipot requested a review from Copilot May 20, 2025 17:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR standardizes test file naming to the *_test.py pattern and aligns code/tests with the change, while also broadening type support.

  • Update test filename globs in CONTRIBUTING.md
  • Adjust existing tests to match new naming and suppress a type-checker warning
  • Enhance unpack type hints to accept both np.ndarray and xarray.DataArray

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

File Description
tests/plotting_test.py Suppress type checker warning on cartopy.crs import with # type: ignore
tests/kinematics_test.py Convert boolean arrays to integer flags to match new test expectations
clouddrift/ragged.py Extend unpack signature to support xarray.DataArray in parameters and return
CONTRIBUTING.md Update pytest/coverage globs to use *_test.py naming
Comments suppressed due to low confidence (2)

clouddrift/ragged.py:792

  • The default of None for rows isn’t covered by the current type annotation. Consider using rows: int | Iterable[int] | None or Optional[int | Iterable[int]].
rows: int | Iterable[int] = None,

tests/kinematics_test.py:27

  • Replacing boolean literals with 1/0 may introduce unintended type mismatches when downstream code expects booleans. Consider using True/False or explicitly converting the array dtype.
[1, 1, 1, 0, 0],

from unittest.mock import patch

import cartopy.crs as ccrs
import cartopy.crs as ccrs # type: ignore
Copy link

Copilot AI May 20, 2025

Choose a reason for hiding this comment

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

[nitpick] Adding a brief comment explaining why the type check is ignored here could help future maintainers understand the suppressed warning.

Suggested change
import cartopy.crs as ccrs # type: ignore
import cartopy.crs as ccrs # type: ignore # cartopy does not provide complete type stubs

Copilot uses AI. Check for mistakes.
@philippemiron
Copy link
Copy Markdown
Contributor Author

There were exceptions in pyproject.toml to make mypy pass. I forgot to rename them.

@selipot
Copy link
Copy Markdown
Member

selipot commented May 27, 2025

@KevinShuman Shall we merge?

@KevinShuman KevinShuman merged commit 8fb84a2 into main May 27, 2025
21 of 22 checks passed
@philippemiron philippemiron deleted the show-tests-vscode branch August 3, 2025 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Development

Successfully merging this pull request may close these issues.

Test suite no longer shows in vscode testing extension

4 participants