skillfed

testpath

Test utilities for code working with files and commands

testpath v0.6.0 1.8M downloads/30d#3,577 on PyPI31
Permissive license AGING released

What it is and what it does

Testpath is a small testing utility library that provides helpers for code that needs to verify filesystem state and mock system command execution. It offers functions like `assert_isfile()` to check file existence and a context manager to record and verify calls to external commands like `git`. The package has no runtime dependencies, making it lightweight to add to test suites.

It's designed for developers writing tests that interact with the filesystem or shell commands—situations where you want to verify that your code called the right external tools or created the expected files. The library sits in the Jupyter ecosystem and is used by projects that need reliable, simple assertions for file and command testing.

Use it for:

  • Verify that your code creates or modifies expected files during testing without leaving test artifacts.
  • Mock and record calls to system commands like git, ensuring your code invokes them with correct arguments.
  • Assert filesystem state in unit tests—check that a file exists or is a directory.
  • Test code that shells out to external tools by capturing and validating command invocations.
  • Build test suites for file-processing utilities that need to verify output files and side effects.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Testpath provides utilities for testing code that interacts with files and system commands, including filesystem assertions and mocking of command-line calls.

Yes, if you're testing code that touches the filesystem or calls system commands. It's lightweight, permissively licensed, and has no dependencies. The aging maintenance status is a minor concern—the package is stable and unlikely to need frequent updates—but verify compatibility with your test framework before committing to it in a new project.

Install

testpath on PyPI

pip

pip install testpath

uv

uv add testpath

poetry

poetry add testpath

Installing testpath

Before you install

Low install friction with no runtime dependencies. Maintenance is aging—last release was in 2022, though the repository remains active.

License in practice

Licensed under BSD (permissive), so you can use it freely in commercial and open-source projects without significant restrictions.

Quickstart

pip install testpath

import testpath
testpath.assert_isfile(path)

with testpath.assert_calls('git', ['add', path]):
    function_under_test()

Verify before relying

  • Whether the package is actively maintained or in maintenance-only mode given the gap between last release and current date.
  • Compatibility with modern testing frameworks beyond the stated Python 3.5+ support.

Package facts

License not declared (permissive)
Python support supports the current Python release (>= 3.5)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance aging — 1,633 days since the last release
Last repo commit
First released
Downloads 1,766,957/month — #3,577 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: testpath-0.6.0-py3-none-any.whl

Intended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: Software Development :: Testing

Tags

test file assertionsmock system commandsfilesystem testing utilitiescommand call recordingtest utilities for filestesting file operationsassert file exists
filesystem-testingcommand-mocking

More Testing packages