Example #1
0
def test_make_exclude_flags_includes_exclude_patterns_filename_when_given():
    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_patterns': ['*.pyc', '/var']},
        exclude_patterns_filename='/tmp/excludes',
    )

    assert exclude_flags == ('--exclude-from', '/tmp/excludes')
Example #2
0
def test_make_exclude_flags_includes_both_filenames_when_patterns_given_and_exclude_from_in_config():
    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_from': ['excludes']},
        exclude_filename='/tmp/excludes',
    )

    assert exclude_flags == ('--exclude-from', 'excludes', '--exclude-from', '/tmp/excludes')
Example #3
0
def test_make_exclude_flags_considers_none_exclude_from_filenames_as_empty():
    flexmock(module).should_receive('_write_exclude_file').and_return(None)

    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_from': None}, )

    assert exclude_flags == ()
Example #4
0
def test_make_exclude_flags_includes_exclude_from_filenames_when_in_config():

    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_from': ['excludes', 'other']})

    assert exclude_flags == ('--exclude-from', 'excludes', '--exclude-from',
                             'other')
Example #5
0
def test_make_exclude_flags_includes_exclude_patterns_filename_when_given():
    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_patterns': ['*.pyc', '/var']},
        exclude_patterns_filename='/tmp/excludes',
    )

    assert exclude_flags == ('--exclude-from', '/tmp/excludes')
Example #6
0
def test_make_exclude_flags_includes_exclude_from_filenames_when_in_config():
    flexmock(module).should_receive('_write_exclude_file').and_return(None)

    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_from': ['excludes', 'other']},
    )

    assert exclude_flags == ('--exclude-from', 'excludes', '--exclude-from', 'other')
Example #7
0
def test_make_exclude_flags_considers_none_exclude_from_filenames_as_empty():
    flexmock(module).should_receive('_write_exclude_file').and_return(None)

    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_from': None},
    )

    assert exclude_flags == ()
Example #8
0
def test_make_exclude_flags_includes_exclude_from_filenames_when_in_config():
    flexmock(module).should_receive('_write_exclude_file').and_return(None)

    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_from': ['excludes', 'other']}, )

    assert exclude_flags == ('--exclude-from', 'excludes', '--exclude-from',
                             'other')
Example #9
0
def test_make_exclude_flags_includes_both_filenames_when_patterns_given_and_exclude_from_in_config():
    flexmock(module).should_receive('_write_exclude_file').and_return(None)

    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_from': ['excludes']},
        exclude_patterns_filename='/tmp/excludes',
    )

    assert exclude_flags == ('--exclude-from', 'excludes', '--exclude-from', '/tmp/excludes')
Example #10
0
def test_make_exclude_flags_includes_both_filenames_when_patterns_given_and_exclude_from_in_config(
):
    flexmock(module).should_receive('_write_exclude_file').and_return(None)

    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_from': ['excludes']},
        exclude_patterns_filename='/tmp/excludes',
    )

    assert exclude_flags == ('--exclude-from', 'excludes', '--exclude-from',
                             '/tmp/excludes')
Example #11
0
def test_make_exclude_flags_is_empty_when_config_has_no_excludes():
    exclude_flags = module._make_exclude_flags(location_config={})

    assert exclude_flags == ()
Example #12
0
def test_make_exclude_flags_includes_exclude_if_present_when_in_config():
    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_if_present': 'exclude_me'})

    assert exclude_flags == ('--exclude-if-present', 'exclude_me')
Example #13
0
def test_make_exclude_flags_does_not_include_exclude_caches_when_false_in_config(
):
    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_caches': False})

    assert exclude_flags == ()
Example #14
0
def test_make_exclude_flags_includes_exclude_caches_when_true_in_config():
    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_caches': True})

    assert exclude_flags == ('--exclude-caches', )
Example #15
0
def test_make_exclude_flags_considers_none_exclude_from_filenames_as_empty():
    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_from': None})

    assert exclude_flags == ()
Example #16
0
def test_make_exclude_flags_does_not_include_exclude_caches_when_false_in_config():
    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_caches': False},
    )

    assert exclude_flags == ()
Example #17
0
def test_make_exclude_flags_includes_exclude_if_present_when_in_config():
    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_if_present': 'exclude_me'},
    )

    assert exclude_flags == ('--exclude-if-present', 'exclude_me')
Example #18
0
def test_make_exclude_flags_includes_exclude_caches_when_true_in_config():
    exclude_flags = module._make_exclude_flags(
        location_config={'exclude_caches': True},
    )

    assert exclude_flags == ('--exclude-caches',)
Example #19
0
def test_make_exclude_flags_is_empty_when_config_has_no_excludes():
    exclude_flags = module._make_exclude_flags(location_config={})

    assert exclude_flags == ()