pytest-dev / pytest-dev/pyfakefs

Make stand-alone usage of fake modules besides FakeOsModule possible

Open
#1,184 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
750
Forks
99
Avg merge
19h 6m
Merged PRs (30d)
6

Description

There are use cases to use the patched modules separately from the Patcher and all derived methods.
This was actually the original usage at Google, before the Patcher and the related infrastructure had been added by @jmcgeheeiv, and came up recently for example in #1171.

Currently, only the os module can be reliably patched as a standalone module, both because some global patching is done in the Patcher code, and because other modules may depend on one another.

It shall be possible to use other patched modules seamlessly without the need for the Patcher (or the related fixture/testcase class/decorator). This is related to the patched shutil, pathlib, io and possibly tempfile modules.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining FakeOsModule and the Patcher to understand why standalone use currently works only for os. Then trace the patched shutil, pathlib, io, and possibly tempfile modules and their fixture, testcase, and decorator integrations; done means these modules can be used independently and work together without the Patcher.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.