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

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.2.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

narmock-0.1.2-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file narmock-0.1.2.tar.gz.

File metadata

  • Download URL: narmock-0.1.2.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.1 Linux/4.15.0-1028-gcp

File hashes

Hashes for narmock-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1844757aae7dc9dc80f2ea0a4e5327de055d98a033ae372f2064981df8099b34
MD5 a7bc6c3e77afde96cd480467323321e4
BLAKE2b-256 b1d7e6f5dec7fb7ce8558ab9b28a1ce8596bb4b43083963ad17da289538770e5

See more details on using hashes here.

File details

Details for the file narmock-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: narmock-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.1 Linux/4.15.0-1028-gcp

File hashes

Hashes for narmock-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e8c0baf5ba52cb2b417cab6b9156ee298d4924af3345b13496497ad8686951bd
MD5 99f4b37bd610779314a91aec9fed7145
BLAKE2b-256 a0a54c655df6033772c798bcb71e0216c5475bde1022f1d7e2280263b1d963f3

See more details on using hashes here.

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