https://github.com/avengineers/hammocking
Automatic mocking tool for C
https://github.com/avengineers/hammocking
automation c clang googlemock googletest mocking stubbing unittest
Last synced: about 2 months ago
JSON representation
Automatic mocking tool for C
- Host: GitHub
- URL: https://github.com/avengineers/hammocking
- Owner: avengineers
- License: mit
- Created: 2022-06-28T14:59:18.000Z (almost 4 years ago)
- Default Branch: develop
- Last Pushed: 2026-04-28T14:37:16.000Z (about 2 months ago)
- Last Synced: 2026-04-28T16:28:28.148Z (about 2 months ago)
- Topics: automation, c, clang, googlemock, googletest, mocking, stubbing, unittest
- Language: Python
- Homepage: https://avengineers.github.io/hammocking
- Size: 6.24 MB
- Stars: 9
- Watchers: 1
- Forks: 7
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README
# Hammocking
Automatic mocking tool for C.
## Installation
Install from PyPI:
```bash
pip install hammocking
```
Or with uv:
```bash
uv add hammocking
```
Hammocking depends on Jinja2 and libclang. They are installed automatically.
## Development
### DevPod / Dev Container (recommended)
The fastest way to get a working development environment is [DevPod](https://devpod.sh/) or any [devcontainer](https://containers.dev/)-compatible tool (VS Code Dev Containers, GitHub Codespaces).
```bash
# Using DevPod CLI
devpod up https://github.com/avengineers/hammocking
# Or in VS Code: clone the repo, open it, and select "Reopen in Container"
```
The container comes with Python 3.13, uv, clang, llvm, cmake, and ninja-build.
### Linux / macOS
#### Prerequisites
- Python 3.10 or higher (3.13 recommended)
- Git
Optional, for integration tests:
- clang / llvm
- cmake
- ninja-build
On Ubuntu/Debian:
```bash
sudo apt update
sudo apt install python3.13 python3.13-venv python3-pip git
# Optional: tools for integration tests
sudo apt install clang llvm cmake ninja-build
```
#### Build
```bash
./build.sh # full build (lint, test, docs)
./build.sh --clean # clean build
./build.sh --install # install dependencies only
```
### Windows
#### Build
```powershell
.\build.ps1 # full build (lint, test, docs)
.\build.ps1 -clean # clean build
.\build.ps1 -install # install dependencies only
```
### Setting up the development environment manually
```bash
uv sync
uv run pre-commit install
```
### Running tests
```bash
uv run pytest # all tests
uv run pytest -m unit # unit tests only
uv run pytest -m integration # integration tests only
```
If integration tests fail because clang is not installed, skip them:
```bash
uv run pytest -m "not integration"
```
### What the build does
- Pre-commit checks and linting
- Running all tests
- Building documentation
## Troubleshooting
### uv not found
Make sure `~/.local/bin` is on your PATH:
```bash
export PATH="$HOME/.local/bin:$PATH"
```
Add this line to your `~/.bashrc` or `~/.zshrc` to make it permanent.
### Lock file errors
```bash
uv lock
uv sync
```
## Links
- Documentation: https://hammocking.readthedocs.io
- PyPI: https://pypi.org/project/hammocking/
- Issues: https://github.com/avengineers/hammocking/issues