Passed
Pull Request — master (#307)
by Jaisen
02:05 queued 45s
created

elodie.tests.constants_test   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 33
dl 0
loc 44
rs 10
c 0
b 0
f 0
wmc 4

4 Functions

Rating   Name   Duplication   Size   Complexity  
A test_debug() 0 2 1
A test_application_directory_override_invalid() 0 5 1
A test_application_directory_default() 0 4 1
A test_application_directory_override_valid() 0 6 1
1
from __future__ import absolute_import
2
# Project imports
3
4
import os
5
import sys
6
import unittest 
7
8
try:
9
    reload  # Python 2.7
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable reload does not seem to be defined.
Loading history...
10
except NameError:
11
    try:
12
        from importlib import reload  # Python 3.4+
13
    except ImportError:
14
        from imp import reload  # Python 3.0 - 3.3
15
16
from mock import patch
17
18
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))))
19
20
from elodie import constants
21
22
BASE_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
23
24
def test_debug():
25
    assert constants.debug == False, constants.debug
26
27
def test_application_directory_default():
28
    reload(constants)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable reload does not seem to be defined.
Loading history...
29
    expected_path = '{}/.elodie'.format(os.path.expanduser('~'))
30
    assert constants.application_directory == expected_path, constants.application_directory
31
32
def test_application_directory_override_invalid():
33
    os.environ['ELODIE_APPLICATION_DIRECTORY'] = '/foo/bar'
34
    reload(constants)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable reload does not seem to be defined.
Loading history...
35
    expected_path = '{}/.elodie'.format(os.path.expanduser('~'))
36
    assert constants.application_directory == expected_path, constants.application_directory
37
38
def test_application_directory_override_valid():
39
    os.environ['ELODIE_APPLICATION_DIRECTORY'] = os.getcwd()
40
    reload(constants)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable reload does not seem to be defined.
Loading history...
41
    expected_path = os.getcwd()
42
    print expected_path
43
    assert constants.application_directory == expected_path, constants.application_directory
44