Skip to content

Instantly share code, notes, and snippets.

@dhilst
dhilst / gkos_char_device.c
Created April 29, 2013 01:12
Device Driver Hello World
/*
* file: gkos_char_device.c
*
* Desc: A simple device that
* echos a message when read,
* write method not implemented
*
* This was made on top of
* LDD and LKMPG examples
*
@1f0
1f0 / cv2_streamiing.py
Last active April 27, 2023 06:14
cv2 rtmp streaming example
import numpy as np
import cv2
cap = cv2.VideoCapture('rtmp://localhost/live/stream')
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
@zobayer1
zobayer1 / pytest_parametrize.md
Last active April 30, 2025 03:20
Using pytest parametrize with indirect for multiple test functions

Using pytest.mark.parametrize with other fixtures

Introduction

When you want to run tests against multiple test parameters, but you have to use other pytest.fixture objects, you can use pytest.mark.parametrize with indirect parameter to target a fixture for extracting request.param from parametrize list.

Example

@sadra-barikbin
sadra-barikbin / README.md
Last active May 11, 2025 12:52
How does pytest work?

In this tutorial we're going to follow the execution flow of pytest to see how it does work. Pytest is highly extendable to the extent that not only its plugins but also its core functionalities are implemented as plugins. Generally, A program and its plugins work in the way that program starts and at some specific steps of its execution, it gives control to the plugins. Those specific steps are called hooks. The program has a registered list of plugins that once program reaches a hook, their corresponding hook implementations are called in a specific order.

For its plugin system, pytest relies on Pluggy. As per Pluggy, program should hold an instance of PluginManager which is in charge of keeping hook specifications, registering plugins and calling them. Program declares its hooks specification and adds it to the plugin manager. Then plugins can register themselves to the plugin manager.

When a hook is called, its implementations are called in LIFO order, the later