Skip to main content

A minimal mocking utility for C projects.

Project description

🔧 narmock

Build Status PyPI PyPI - Python Version Code style: black

A minimal mocking utility for C projects.

🚧 Work in progress 🚧

Narmock identifies the mocks being used in your tests and generates easy-to-use implementations with a slick API.

#include <time.h>

#include "__mocks__.h"
#include "narwhal.h"

TEST(example)
{
    MOCK(time)->mock_return(42);
    ASSERT_EQ(time(NULL), 42);
}

Most of the examples in this README are tests written with Narwhal but Narmock can be used with other test frameworks and anywhere in regular source code.

Installation

The package can be installed with pip.

$ pip install narmock

Contributing

Contributions are welcome. Feel free to open issues and suggest improvements. This project uses poetry so you'll need to install it first if you want to be able to work with the project locally.

$ curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python

You should now be able to install the required dependencies.

$ poetry install

The code follows the black code style.

$ poetry run black narmock

You can run the tests with poetry run make -C tests. The test suite is built with Narwhal.

$ poetry run make -C tests

License - MIT

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

narmock-0.1.3.tar.gz (9.2 kB view hashes)

Uploaded Source

Built Distribution

narmock-0.1.3-py3-none-any.whl (10.6 kB view hashes)

Uploaded Python 3

Supported by

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