$npx skillfedfor your agent

pyfakefs

Implements a fake file system that mocks the Python file system modules.

Worth itPyPI LibrariesReleased Apr 20264.5M downloads / moApache-2.0Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pyfakefs-6.2.0-py3-none-any.whl
v6.2.0 · released 2026-04-12 · Python >=3.10

Yes. pyfakefs is production-stable (Development Status 5), actively maintained, has no security vulnerabilities, and zero runtime dependencies. It solves a real testing problem—isolating filesystem operations—and is widely used. Install it if your test suite touches the filesystem.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.10 or later; C-based filesystem libraries cannot be mocked by pyfakefs.
  • Low friction: pure Python wheel with no runtime dependencies.
  • Actively maintained with recent releases; last commit 2026-08-13.

License · maintenance · safety

Apache-2.0 (permissive) — Apache-2.0 (permissive): you can use, modify, and distribute pyfakefs freely in commercial and private projects, provided you include a copy of the license and state significant changes.

last release 2026-04-12 (124 days) · last repo commit 2026-08-13 · 750 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 4,466,529 downloads/mo, #2,298 on PyPI

Verify before relying

pip install pyfakefs

from pyfakefs import fake_filesystem_unittest

class TestWithFakeFS(fake_filesystem_unittest.TestCase):
    def setUp(self):
        self.setUpPyfakefs()
    
    def test_file_operations(self):
        self.fs.create_file('/tmp/test.txt', contents='hello')
        with open('/tmp/test.txt') as f:
            self.assertEqual(f.read(), 'hello')
  • Performance characteristics when filesystem size grows or test count scales
  • Compatibility with specific C-based libraries beyond the documented limitations
  • Whether all test frameworks and plugins work seamlessly with pyfakefs patching
Same gist for agents: .md · .json

What it is and what it does

pyfakefs is a testing library that replaces the real filesystem with an in-memory fake one during test execution. It automatically mocks Python's file system modules so your tests can create, read, and manipulate files without touching disk. Each test gets a fresh empty filesystem, making tests isolated and fast. The library works with unittest (via TestCase subclass or Patcher context manager) and as a decorator on individual tests.

The package handles cross-platform testing by emulating Linux, Windows, and macOS filesystems, and includes features like mapping real files into the fake filesystem, tracking filesystem size, pausing/resuming patching, and simulating non-root user behavior. It does not work with libraries that use C-level filesystem access, since pyfakefs cannot patch underlying C library calls.

Use it for

  • Test file I/O code (reading, writing, deleting) without creating temporary files on disk
  • Verify error handling for missing files or permission issues in a controlled environment
  • Run filesystem-heavy test suites in parallel without disk contention or cleanup overhead
  • Test cross-platform file path logic (Windows vs. POSIX) on a single machine
  • Simulate full filesystem scenarios (large directory trees, disk full conditions) cheaply in memory

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

pyfakefs is production-stable (Development Status 5), actively maintained, has no security vulnerabilities, and zero runtime dependencies. It solves a real testing problem—isolating filesystem operations—and is widely used. Install it if your test suite touches the filesystem.

Install

pyfakefs on PyPI

Before you install

Low friction: pure Python wheel with no runtime dependencies. Actively maintained with recent releases; last commit 2026-08-13. Supports current Python versions on Linux, Windows, and macOS.

Requires Python 3.10 or later; C-based filesystem libraries cannot be mocked by pyfakefs.

License in practice

Apache-2.0 (permissive): you can use, modify, and distribute pyfakefs freely in commercial and private projects, provided you include a copy of the license and state significant changes.

Quickstart

pip install pyfakefs

from pyfakefs import fake_filesystem_unittest

class TestWithFakeFS(fake_filesystem_unittest.TestCase):
    def setUp(self):
        self.setUpPyfakefs()
    
    def test_file_operations(self):
        self.fs.create_file('/tmp/test.txt', contents='hello')
        with open('/tmp/test.txt') as f:
            self.assertEqual(f.read(), 'hello')

Verify before relying

  • Performance characteristics when filesystem size grows or test count scales
  • Compatibility with specific C-based libraries beyond the documented limitations
  • Whether all test frameworks and plugins work seamlessly with pyfakefs patching

Package facts

LicenseApache-2.0 permissive
Python supportSupports the current Python release >=3.10
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceActively maintained 124 days since the last release
Last repo commit
First released
Downloads4,466,529 / month, #2,298 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableEnvironment :: ConsoleFramework :: PytestIntended Audience :: DevelopersOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: TestingTopic :: System :: Filesystems

Evidence: pyfakefs-6.2.0-py3-none-any.whl

Tags

Capabilities
mock filesystem for testingfake file system testingin-memory filesystem testingfile system mocking librarytest file operations without diskunittest filesystem mockingtemporary filesystem per test
Topics
test-isolationmockingfilesystem
PyPI keywords
testingfilesystemmockingunittestpytest

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “fake file system testing”

  • pyfakefspyfakefs mocks the Python file system modules to run tests against an…
  • mock-openProvides a drop-in replacement for mock.mock_open that supports…
  • faker-eduGenerates fake data for educational institutions and academic…

Give your agent the search over MCP, or paste the wish link into any chat.

More Libraries packages

urllib3 Worth it
PyPI · Libraries · released May 2026

urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.

MITpure Python · 3.10+
1.8Bdownloads / mo
requests Worth it
PyPI · Libraries · released May 2026

Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.

Apache-2.0pure Python · 3.10+
1.8Bdownloads / mo
pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
python-dateutil Worth it
PyPI · Libraries · released Mar 2024

Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.

Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.

Apache-2.0pure Python
1.2Bdownloads / mo
six With conditions
PyPI · Libraries · released Dec 2024

Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.

MITpure Python
1.2Bdownloads / mo
pytest Worth it
PyPI · Libraries · released Jun 2026

pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.

MITpure Python · 3.10+
1.1Bdownloads / mo

See also mock-open · mock-firestore · flexmock · testpath · fatfs-ng · morefs · fakesnow · pytest-responses · kgb · mfusepy