FunAlone
A small python library that makes it easy to test a function alone, that is, mocking all dependencies. True unittests, without having to manually look and add every called function to an increasing list of @mock.patch decorators.
Example
Say you have a function named do_a_lot_of_stuff and you want to test it with unittest, only testing the functions code, not the function that it calls within.
def do_a_lot_of_stuff(arg: int):
if arg > 5:
result = do_this(arg)
elif arg < 0:
result = do_that(arg)
else:
result = do_nothing(arg)
return result
In this case you might want to know which external function has been called, depending on the input, without having the code actually call that function (which could have side effects and should have it's own unit tests).
class Test(unittest.TestCase):
def test_do_a_lot_of_stuff_with_5(self):
with IsolatedFunctionClone(
do_a_lot_of_stuff
) as do_a_lot_of_stuff_clone:
# This calls a function clone with an isolated context.
# All external names are mocked.
do_a_lot_of_stuff_clone(5)
# You can access this context later to assert calls,
# And you can use the original functions to do this,
# so it's all refactor-friendly.
do_a_lot_of_stuff_clone.context[do_this].assert_not_called()
do_a_lot_of_stuff_clone.context[do_that].assert_not_called()
do_a_lot_of_stuff_clone.context[do_nothing].assert_called_once()
There are more parameters and ways to use the library, this is only a basic example.
Installation
You can install the latest version with pip:
pip install funalone
Tests
There is a small collection of unittests in the test folder.
You can run them using unittest.
Credits
This project is developed by Borja Martinena (borjamartinena[at]gmail.com).
Metadata
Release files for funalone 0.7.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| funalone-0.7.3.tar.gz | 7.0 kB | With provenance | Details for funalone-0.7.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| funalone-0.7.3-py3-none-any.whl | Python 3 | none | any | Details for funalone-0.7.3-py3-none-any.whl |
Total release size: 16.1 kB
Release files / funalone-0.7.3.tar.gz
| Download URL | funalone-0.7.3.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4e5c7e9a6fba826fe63cd916014f21dc00729c50648d42f04a5e514bb511c65
|
|
BLAKE2b-256 checksum How to use checksums |
de2cb4f2a9b2ef0af8ebf3f5d461db58e36ecdc6e5568d2a568b2829c338ef76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 10, 2026.
Transparency logRelease files / funalone-0.7.3-py3-none-any.whl
| Download URL | funalone-0.7.3-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df42d0c21d8055f369c1e91fc85a842985367f368b8fcaa2bc31eed6d90d7fe0
|
|
BLAKE2b-256 checksum How to use checksums |
cd786cc13c17087f1efd5b64508da8a6040c311a67f105369f66d8ac9b210d44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 10, 2026.
Transparency logSecurity for funalone 0.7.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for funalone-0.7.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 10, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.