Skip to content

Use tmp_path instead of tmpdir fixture in test_models_dumper.py #2100

Description

@coderabbitai

Summary

In tests/unit/utils/test_models_dumper.py, the test test_dump_models (and the related fixture usage around lines 67-70) annotates the pytest fixture parameter as Path but receives it via the tmpdir fixture:

def test_dump_models(tmpdir: Path) -> None:
    ...
    filename = tmpdir / "foo.json"

Rationale

The tmpdir fixture returns a py.path.local object, not a pathlib.Path, so the tmpdir: Path type annotation is incorrect and misleading. Modern pytest recommends using the tmp_path fixture, which returns an actual pathlib.Path object, keeping the type annotation accurate and the code aligned with current pytest best practices.

Affected areas

  • tests/unit/utils/test_models_dumper.py (function test_dump_models, also applies to lines 67-70)

Suggested change

Replace the tmpdir fixture parameter with tmp_path, and update usages accordingly:

def test_dump_models(tmp_path: Path) -> None:
    ...
    filename = tmp_path / "foo.json"

Acceptance criteria

  • test_dump_models uses the tmp_path fixture instead of tmpdir.
  • Type annotation Path matches the actual fixture return type.
  • All usages within the test (including lines 67-70) are updated consistently.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions