5
5
def set_options_from_config (config ):
6
6
if config .has_option ('SELENIUM' , 'ENVIRONMENT' ):
7
7
os .environ ['SELENV_ENVIRON' ] = config .get ('SELENIUM' ,'ENVIRONMENT' )
8
- else :
9
- os .environ ['SELENV_ENVIRON' ] = 'develop'
10
8
11
9
if config .has_option ('SELENIUM' , 'BASEURL' ):
12
10
os .environ ['SELENV_BASEURL' ] = config .get ('SELENIUM' , 'BASEURL' )
@@ -16,11 +14,10 @@ def set_options_from_config(config):
16
14
17
15
if config .has_option ('SELENIUM' , 'BROWSER' ):
18
16
os .environ ['SELENV_BROWSER' ] = config .get ('SELENIUM' , 'BROWSER' )
19
- else :
20
- os .environ ['SELENV_BROWSER' ] = 'PHANTOMJS'
21
17
22
18
if config .has_option ('SELENIUM' , 'FBUSER' ):
23
19
os .environ ['SELENV_FBUSER' ] = config .get ('SELENIUM' , 'FBUSER' )
20
+
24
21
if config .has_option ('SELENIUM' , 'FBPASS' ):
25
22
os .environ ['SELENV_FBPASS' ] = config .get ('SELENIUM' , 'FBPASS' )
26
23
@@ -48,16 +45,14 @@ def options(self, parser, env=os.environ):
48
45
parser .add_option ('--env' ,
49
46
action = 'store' ,
50
47
choices = valid_location_options ,
51
- default = env .get ('SELENV_ENVIRO' , 'develop' ),
52
48
dest = 'environment' ,
53
- help = 'Run the browser in this location (default %default, options ' +
49
+ help = 'Run the browser in this location (options ' +
54
50
self ._stringify_options (valid_location_options ) + ').'
55
51
)
56
52
parser .add_option ('--browser' ,
57
53
action = 'store' ,
58
- default = env .get ('SELENV_BROWSER' , 'PHANTOMJS' ),
59
54
dest = 'browser' ,
60
- help = 'Select the type of browser you want Selenium to use. (default %default). '
55
+ help = 'Select the type of browser you want Selenium to use.'
61
56
)
62
57
parser .add_option ('--baseurl' ,
63
58
action = 'store' ,
@@ -67,7 +62,6 @@ def options(self, parser, env=os.environ):
67
62
parser .add_option ('--timeout' ,
68
63
action = 'store' ,
69
64
dest = 'timeout' ,
70
- default = '60' ,
71
65
type = 'str' ,
72
66
help = 'Change the timeout on the fly.'
73
67
)
@@ -93,13 +87,20 @@ def read_config_file(self, config_file):
93
87
set_options_from_config (CONFIG )
94
88
95
89
def set_options (self , options ):
96
- os .environ ['SELENV_ENVIRON' ] = options .environment
97
- os .environ ['SELENV_BROWSER' ] = options .browser
98
- os .environ ['SELENV_BASEURL' ] = options .base_url
99
- os .environ ['SELENV_TIMEOUT' ] = options .timeout
100
- os .environ ['SELENV_FBUSER' ] = options .fb_user
101
- os .environ ['SELENV_FBPASS' ] = options .fb_pass
102
- os .environ ['SELENV_LOGGING' ] = options .logging
90
+ if options .environment :
91
+ os .environ ['SELENV_ENVIRON' ] = options .environment
92
+ if options .browser :
93
+ os .environ ['SELENV_BROWSER' ] = options .browser
94
+ if options .base_url :
95
+ os .environ ['SELENV_BASEURL' ] = options .base_url
96
+ if options .timeout :
97
+ os .environ ['SELENV_TIMEOUT' ] = options .timeout
98
+ if options .fb_user :
99
+ os .environ ['SELENV_FBUSER' ] = options .fb_user
100
+ if options .fb_pass :
101
+ os .environ ['SELENV_FBPASS' ] = options .fb_pass
102
+ if options .logging :
103
+ os .environ ['SELENV_LOGGING' ] = options .logging
103
104
104
105
def configure (self , options , conf ):
105
106
Plugin .configure (self , options , conf )
0 commit comments