make_test_module()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 14
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 14
rs 10
c 0
b 0
f 0
cc 2
nop 0
1
import os
2
3
4
def make_test_module():
5
    """
6
    A function with side-effect of creating a python module
7
    for containing tests at the root of a project.
8
    """
9
    if os.path.exists('./test'):
10
        return None
11
    # If there is a test module present
12
    # at the target location, exit.
13
14
    os.mkdir('./test')
15
    # If there is no `test` module, create one
16
17
    open('./test/__init__.py', 'a').close()
18
    # Create an __init__.py so that
19
    # the dir is identified as a python module
20