Skip to content

Instantly share code, notes, and snippets.

View MichalMazurek's full-sized avatar
😁

Michal Mazurek MichalMazurek

😁
View GitHub Profile
#!/bin/env python
import fire
import random
import humanize
import sys
def make_large_file(file: str, size: int, random: bool=False) -> None:
"""
Create a file with random bytes
@MichalMazurek
MichalMazurek / mock_file.py
Created March 30, 2017 12:25
Pytest fixture for mocking file open
# author: michal@mazurek-inc.co.uk
@pytest.fixture
def mock_file():
"""Mock file open."""
@contextlib.contextmanager
def contextmanager(file_name: str, content: bytes, obj):
"""
Context manager for mocking file.