How to use the flintrock.flintrock.option_requires function in Flintrock

To help you get started, we’ve selected a few Flintrock examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nchammas / flintrock / tests / test_flintrock.py View on Github external
def test_option_requires():
    some_option = 'something'
    unset_option = None
    set_option = '와 짠이다'

    option_requires(
        option='--some-option',
        requires_all=['--set_option'],
        scope=locals()
    )

    option_requires(
        option='--some-option',
        requires_any=[
            '--set_option',
            '--unset-option'],
        scope=locals()
    )

    with pytest.raises(UsageError):
        option_requires(
            option='--some-option',
            requires_all=[
                '--set-option',
                '--unset-option'],
            scope=locals()
        )
github nchammas / flintrock / tests / test_flintrock.py View on Github external
option_requires(
        option='--some-option',
        requires_all=['--set_option'],
        scope=locals()
    )

    option_requires(
        option='--some-option',
        requires_any=[
            '--set_option',
            '--unset-option'],
        scope=locals()
    )

    with pytest.raises(UsageError):
        option_requires(
            option='--some-option',
            requires_all=[
                '--set-option',
                '--unset-option'],
            scope=locals()
        )

    with pytest.raises(UsageError):
        option_requires(
            option='--some-option',
            requires_any=[
                '--unset-option'],
            scope=locals()
        )
github nchammas / flintrock / tests / test_flintrock.py View on Github external
'--unset-option'],
        scope=locals()
    )

    some_option = ''
    option_requires(
        option='--some-option',
        conditional_value='',
        requires_any=[
            '--unset-option'],
        scope=locals()
    )

    with pytest.raises(UsageError):
        some_option = 'magic'
        option_requires(
            option='--some-option',
            conditional_value='magic',
            requires_any=[
                '--unset-option'],
            scope=locals()
        )