Skip to main content

Create mocks for c-code automatically

Project description

Hammocking

CI Status Documentation Status Test coverage percentage

uv ruff pre-commit

PyPI Version Supported Python versions License

Automatic mocking tool for C.

Installation

Install from PyPI:

pip install hammocking

Or with uv:

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 or any devcontainer-compatible tool (VS Code Dev Containers, GitHub Codespaces).

# 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:

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

./build.sh              # full build (lint, test, docs)
./build.sh --clean      # clean build
./build.sh --install    # install dependencies only

Windows

Build

.\build.ps1             # full build (lint, test, docs)
.\build.ps1 -clean      # clean build
.\build.ps1 -install    # install dependencies only

Setting up the development environment manually

uv sync
uv run pre-commit install

Running tests

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:

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:

export PATH="$HOME/.local/bin:$PATH"

Add this line to your ~/.bashrc or ~/.zshrc to make it permanent.

Lock file errors

uv lock
uv sync

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hammocking-1.0.0.tar.gz (402.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hammocking-1.0.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file hammocking-1.0.0.tar.gz.

File metadata

  • Download URL: hammocking-1.0.0.tar.gz
  • Upload date:
  • Size: 402.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hammocking-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0220c9baab9027cfb5a222e44b9220266cfad87e2816883edec6508382d06e8f
MD5 004da80c243df2a119473e704df5b643
BLAKE2b-256 ecaab8a5dfb9bd7d4bf4cdce3fe32d37735a3bd331d89d9830e48e92d102bb78

See more details on using hashes here.

File details

Details for the file hammocking-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: hammocking-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hammocking-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be148ca987aaf3db90fe0b9a098f073b10e8294e37467bf44c84a552a89d293c
MD5 c20a704e8b06213e1dd4996c20e2d652
BLAKE2b-256 61ab78450e2558a290e2bb1c5c17c05a4d503e244416796d799b3b2891a6caa7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page