Passed
Push — master ( 380ebf...e8ce38 )
by Marcus
41s
created

test_system_mayapy_executable_location()   A

Complexity

Conditions 4

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
c 1
b 0
f 0
dl 0
loc 7
rs 9.2
1
"""
2
"""
3
import os
4
import platform
5
6
from mayatest import mayaloc
7
8
9
def test_create_and_return_dir_with_temp_app_dir():
10
    maya_app_dir = os.environ['MAYA_APP_DIR']
11
    with mayaloc.temp_app_dir() as app_dir:
12
        local_appdir = app_dir
13
        assert os.path.exists(app_dir)
14
        assert os.environ['MAYA_APP_DIR'] == app_dir
15
    assert os.path.exists(local_appdir) is False
16
    assert os.environ['MAYA_APP_DIR'] == maya_app_dir
17
18
19
def test_system_return_maya_location():
20
    test_version = 2016
21
    location = mayaloc.get_maya_location(test_version)
22
23
    system = platform.system()
24
    if system == 'Windows':
25
        assert location == 'C:/Program Files/Autodesk/Maya{0}'.format(
26
            test_version)
27
    elif system == 'Darwin':
28
        assert location == ('/Applications/Autodesk/maya{0}/Maya.app/Contents'
29
                            .format(test_version))
30
    else:
31
        unixpath = '/usr/autodesk/maya{0}'.format(test_version)
32
        if test_version < 2016:
33
            # Starting Maya 2016, the default install directory name changed.
34
            unixpath += '-x64'
35
        assert location == unixpath
36
37
38
def test_system_mayapy_executable_location():
39
    test_version = 2017
40
    mayapy_executable = mayaloc.mayapy(test_version)
41
    if platform.system() == 'Windows':
42
        assert mayapy_executable.endswith('/bin/mayapy.exe')
43
    else:
44
        assert mayapy_executable.endswith('/bin/mayapy')
45