Coder Social home page Coder Social logo

mockaioredis's Introduction

Mock library to replace aioredis during unit tests

Build Status

mockaioredis is to aioredis what the mockredispy library is to plain redis-py. It uses the mockredispy library and wraps it in the asyncio magic required to work like aioredis.

Uses the new async keyword for Python 3.5, so no 3.4 support.

Beware: This is an early alpha that isn't even close to API-complete. In fact, so far it only supports the limited set of calls I needed for another project. Eventually, as I use more and more aioredis calls in my other projects, this mock layer will be fleshed out more.

Installation

You can install mockaioredis from PYPI by running pip install mockaioredis.

If you want to update an existing install, run pip install --update mockaioredis.

You can also clone this repository from github and run pip install . from the repository base directory.

Usage

You can use it as a fixture using pytest-mock

import mockaioredis

@pytest.fixture(autouse=True)
def redis(mocker):
    """Mock Redis."""
    mocker.patch.object(aioredis, 'create_pool', new=mockaioredis.create_pool)

License

Like mockredispy, mockaioredis is licensed under the Apache License, Version 2.0. See LICENSE for details.

mockaioredis's People

Contributors

kblin avatar kerizane avatar srxavi avatar arpradhan avatar garyvdm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.