10
10
def test_dl_calc_args ():
11
11
from orientpy .scripts import dl_calc as dl
12
12
# no stdb
13
- with pytest .raises (SystemExit ):
14
- assert dl .get_dl_calc_arguments ()
13
+ with pytest .raises (SystemExit ) as excinfo :
14
+ dl .get_dl_calc_arguments ()
15
+ assert excinfo .value .code == 1
15
16
16
17
# defaults
17
18
args0 = dl .get_dl_calc_arguments ([dbfile ])
@@ -21,21 +22,24 @@ def test_dl_calc_args():
21
22
# start time
22
23
args = dl .get_dl_calc_arguments (
23
24
[dbfile , '--start' , '2014-10-01' ])
24
- with pytest .raises (SystemExit ):
25
- assert dl .get_dl_calc_arguments ([
25
+ with pytest .raises (SystemExit ) as excinfo :
26
+ dl .get_dl_calc_arguments ([
26
27
dbfile , '--start' , 'abcd' ])
28
+ assert excinfo .value .code == 1
27
29
# end time
28
30
args = dl .get_dl_calc_arguments ([
29
31
dbfile , '--end' , '2015-01-01' ])
30
- with pytest .raises (SystemExit ):
31
- assert dl .get_dl_calc_arguments ([
32
+ with pytest .raises (SystemExit ) as excinfo :
33
+ dl .get_dl_calc_arguments ([
32
34
dbfile , '--end' , 'abcd' ])
35
+ assert excinfo .value .code == 1
33
36
# user auth.
34
37
args = dl .get_dl_calc_arguments ([
35
38
dbfile , '-U' , 'bla:bla' ])
36
- with pytest .raises (SystemExit ):
37
- assert dl .get_dl_calc_arguments ([
39
+ with pytest .raises (SystemExit ) as excinfo :
40
+ dl .get_dl_calc_arguments ([
38
41
dbfile , '-U' , 'abcd' ])
42
+ assert excinfo .value .code == 1
39
43
# local data
40
44
args = dl .get_dl_calc_arguments ([
41
45
dbfile , '--local-data' , 'bla' ])
@@ -48,8 +52,9 @@ def test_dl_calc_args():
48
52
def test_dl_average_args ():
49
53
from orientpy .scripts import dl_average as dl
50
54
# no stdb
51
- with pytest .raises (SystemExit ):
52
- assert dl .get_dl_average_arguments ()
55
+ with pytest .raises (SystemExit ) as excinfo :
56
+ dl .get_dl_average_arguments ()
57
+ assert excinfo .value .code == 1
53
58
# defaults
54
59
args0 = dl .get_dl_average_arguments ([dbfile ])
55
60
# keys
@@ -61,8 +66,9 @@ def test_dl_average_args():
61
66
def test_bng_calc_args ():
62
67
from orientpy .scripts import bng_calc_auto as bng
63
68
# no stdb
64
- with pytest .raises (SystemExit ):
65
- assert bng .get_bng_calc_arguments ()
69
+ with pytest .raises (SystemExit ) as excinfo :
70
+ bng .get_bng_calc_arguments ()
71
+ assert excinfo .value .code == 1
66
72
# default
67
73
args0 = bng .get_bng_calc_arguments ([dbfile ])
68
74
# keys
@@ -71,21 +77,24 @@ def test_bng_calc_args():
71
77
# start time
72
78
args = bng .get_bng_calc_arguments (
73
79
[dbfile , '--start' , '2014-10-01' ])
74
- with pytest .raises (SystemExit ):
75
- assert bng .get_bng_calc_arguments ([
80
+ with pytest .raises (SystemExit ) as excinfo :
81
+ bng .get_bng_calc_arguments ([
76
82
dbfile , '--start' , 'abcd' ])
83
+ assert excinfo .value .code == 1
77
84
# end time
78
85
args = bng .get_bng_calc_arguments ([
79
86
dbfile , '--end' , '2015-01-01' ])
80
- with pytest .raises (SystemExit ):
81
- assert bng .get_bng_calc_arguments ([
87
+ with pytest .raises (SystemExit ) as excinfo :
88
+ bng .get_bng_calc_arguments ([
82
89
dbfile , '--end' , 'abcd' ])
90
+ assert excinfo .value .code == 1
83
91
# user auth.
84
92
args = bng .get_bng_calc_arguments ([
85
93
dbfile , '-U' , 'bla:bla' ])
86
- with pytest .raises (SystemExit ):
87
- assert bng .get_bng_calc_arguments ([
94
+ with pytest .raises (SystemExit ) as excinfo :
95
+ bng .get_bng_calc_arguments ([
88
96
dbfile , '-U' , 'abcd' ])
97
+ assert excinfo .value .code == 1
89
98
# local data
90
99
args = bng .get_bng_calc_arguments ([
91
100
dbfile , '--local-data' , 'bla' ])
@@ -95,23 +104,26 @@ def test_bng_calc_args():
95
104
# bp
96
105
args = bng .get_bng_calc_arguments ([
97
106
dbfile , '--bp' , '1.,2.' ])
98
- with pytest .raises (SystemExit ):
99
- assert bng .get_bng_calc_arguments ([
107
+ with pytest .raises (SystemExit ) as excinfo :
108
+ bng .get_bng_calc_arguments ([
100
109
dbfile , '--bp' , '1.' ])
110
+ assert excinfo .value .code == 1
101
111
# tt
102
112
args = bng .get_bng_calc_arguments ([
103
113
dbfile , '--times' , '1.,2.' ])
104
- with pytest .raises (SystemExit ):
105
- assert bng .get_bng_calc_arguments ([
114
+ with pytest .raises (SystemExit ) as excinfo :
115
+ bng .get_bng_calc_arguments ([
106
116
dbfile , '--times' , '1.' ])
117
+ assert excinfo .value .code == 1
107
118
108
119
return args0
109
120
110
121
def test_bng_average_args ():
111
122
from orientpy .scripts import bng_average as bng
112
123
# no stdb
113
- with pytest .raises (SystemExit ):
114
- assert bng .get_bng_average_arguments ()
124
+ with pytest .raises (SystemExit ) as excinfo :
125
+ bng .get_bng_average_arguments ()
126
+ assert excinfo .value .code == 1
115
127
# defaults
116
128
args0 = bng .get_bng_average_arguments ([dbfile ])
117
129
# keys
0 commit comments