Metadata-Version: 2.1
Name: conditional-context
Version: 1.0.2
Summary: Context manager that will skip the body on a condition.
Home-page: https://github.com/justengel/conditional_context
Author: Justin Engel
Author-email: jtengel08@gmail.com
License: MIT
Download-URL: https://github.com/justengel/conditional_context/archive/v1.0.2.tar.gz
Keywords: conditional context skip context
Platform: any
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent

===================
conditional_context
===================

Context manager that will skip the body on a condition.

All code is in `conditional_context/__init__.py`

.. code-block:: python

    from conditional_context import condition

    print('start')
    value = True
    with condition(False):
        value = False
        print('here')  # Will not print
    print('end')

    assert value


.. code-block:: python

    import conditional_context

    class MyContext(conditional_context.ConditionalContext):
        def should_skip(self):
            return True

    print('start')
    value = True
    with MyContext():
        value = False
        print('here')  # Will not print
    print('end')

    assert value


