Completed
Push — master ( 725799...d9d8f9 )
by Bjorn
01:03
created

tests.test_skippy()   D

Complexity

Conditions 8

Size

Total Lines 25

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 8
dl 0
loc 25
rs 4
1
# -*- coding: utf-8 -*-
2
import os
3
4
# from dkfileutils import path
5
from dkfileutils.listfiles import list_files, read_skipfile
6
from yamldirs import create_files
7
8
9
BASEDIR = os.path.dirname(__file__)
10
11
12
def test_skipfile():
13
    assert read_skipfile('.', ['foo']) == ['foo']
14
15
16
def test_listfiles():
17
    assert list(list_files('empty')) == []
18
19
20
def test_skippy():
21
    files = """
22
        - a
23
        - b
24
        - f:
25
            - .dotfile
26
        - __pycache__:
27
            - c
28
        - htmlcov:
29
            - d
30
        - e.pyc
31
        - foo.egg-info:
32
            - e
33
    """
34
    with create_files(files) as root:
35
        assert [fname for _hex, fname in list_files(root, root)] == [
36
            'a', 'b'
37
        ]
38
39
        assert [fname for _hex, fname in list_files(root, root, False)] == [
40
            os.path.join(root, 'a').replace('\\', '/'),
41
            os.path.join(root, 'b').replace('\\', '/')
42
        ]
43
44
        assert [fname for _hex, fname in list_files(os.path.join(root, '.dotdir'), root)] == []
45