Running C unit tests with pytest

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • c_unit_tests

    C unit tests with a small header-only library.

  • Shameless self-plug since I recently made a small header-only C testing "framework":

    https://github.com/rubenvannieuwpoort/c_unit_tests

  • hypothesis

    Hypothesis is a powerful, flexible, and easy to use library for property-based testing.

  • We've had a lot of success combining that approach with property-based testing (https://github.com/HypothesisWorks/hypothesis) for the query engine at backtrace: https://engineering.backtrace.io/2020-03-11-how-hard-is-it-t... .

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • headlock

    An adapter for making C code testable from Python (see https://headlock.readthedocs.io/en/latest)

  • time-machine

    Travel through time in your tests.

  • There are lots of good mocking fixtures available for pytest. I've used this one for clock stuff in the past: https://github.com/adamchainz/time-machine#pytest-plugin

  • examc

    proof of concept C unit test library using linker sections

  • Indeed, I just made a POC with compiler sections: https://github.com/cozzyd/examc

    This implementation only works with gcc though probably (it uses the automatic __start_SECTION and __stop_SECTION that gcc generates but clang doesn't seem to... there are likely hacks to make this work anyway though).

  • docker-images

    Docker images for ci testing (by python-pillow)

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts