Skip to content

Instantly share code, notes, and snippets.

View ilyasotkov's full-sized avatar

Ilya Sotkov ilyasotkov

  • Helsinki, Finland
  • 01:59 (UTC +03:00)
View GitHub Profile
@ilyasotkov
ilyasotkov / test_cycle_through_responses.py
Created March 18, 2022 09:53
Pytest, cycling through responses
import sys
from itertools import cycle
from unittest import mock
def test_cycle_through_responses(monkeypatch):
return_data = ["h", "hello"]
test_mock = mock.Mock(side_effect=cycle(return_data))
m = sys.modules[__name__]
@ilyasotkov
ilyasotkov / fire_and_forget_fixture_test.py
Created March 16, 2022 11:16
Fire and forget pytest fixtures, two ways
import asyncio
import logging
import threading
import time
import pytest
def test_1(my_thread_async_fixture):
logging.warning("Test started")
@ilyasotkov
ilyasotkov / nginx.conf
Last active August 8, 2019 18:50
Merged /etc/nginx/nginx.conf and /etc/nginx/conf.d/default.conf from official Docker image with comments removed
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
@ilyasotkov
ilyasotkov / cloudformation_yaml_params_with_yq.md
Last active August 19, 2020 04:01
CloudFormation YAML Parameter Values with yq (https://github.com/kislyuk/yq)
# ./template.yaml
AWSTemplateFormatVersion: 2010-09-09

Parameters:
  BucketName:
    Type: String
    
Resources:
 Bucket: