forked from LordAmit/mobile-monkey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontextConfig_reader.py
executable file
·38 lines (33 loc) · 1.16 KB
/
contextConfig_reader.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'''
context config reader for app
'''
import configparser as ConfigParser
import config_reader as config
class ContextConfigReader(object):
'''
reads the context config
'''
def __init__(self):
pass
@staticmethod
def context_config_reader(option, uid):
'''
reads the config file in the specified uid:
:param option: specifies the option to look for
:param uid: specifies the UID of the folder containing the contextConfigFile
'''
context_config = ConfigParser.ConfigParser()
context_config_file_location = config.TEMP + uid + '/contextConfigFile'
# context_config.read(
# "/home/amit/git/
# mobile_application_contextual_testing/emulator_manager/temp/contextConfigFile")
try:
context_config.read(context_config_file_location)
value = context_config.get('context', option)
return value
except ConfigParser.NoSectionError:
print("Error: section context not found")
exit()
except FileNotFoundError:
print(context_config_file_location + " not found: ")
exit()