File tree 1 file changed +23
-4
lines changed
1 file changed +23
-4
lines changed Original file line number Diff line number Diff line change
1
+ from typing import Callable
2
+
3
+ import pytest
4
+ from requests import HTTPError
5
+
1
6
import finagg
2
7
3
8
9
+ def skip_if_503 (f : Callable ) -> None :
10
+ """The BEA API is notorious for being unreliable. We don't really
11
+ support maintaining the BEA API's Python client implementation anymore,
12
+ so we just skip if they error out. We'll keep them just in case we
13
+ feel like supporting it in the future.
14
+
15
+ """
16
+ try :
17
+ f ()
18
+ except HTTPError as e :
19
+ if e .response .status_code == 503 :
20
+ pytest .skip ()
21
+
22
+
4
23
def test_fixed_assets_get_parameter_list () -> None :
5
- finagg .bea .api .fixed_assets .get_parameter_list ( )
24
+ skip_if_503 ( finagg .bea .api .fixed_assets .get_parameter_list )
6
25
7
26
8
27
def test_gdp_by_industry_get_parameter_list () -> None :
9
- finagg .bea .api .gdp_by_industry .get_parameter_list ( )
28
+ skip_if_503 ( finagg .bea .api .gdp_by_industry .get_parameter_list )
10
29
11
30
12
31
def test_input_output_get_parameter_list () -> None :
13
- finagg .bea .api .input_output .get_parameter_list ( )
32
+ skip_if_503 ( finagg .bea .api .input_output .get_parameter_list )
14
33
15
34
16
35
def test_nipa_get_parameter_list () -> None :
17
- finagg .bea .api .nipa .get_parameter_list ( )
36
+ skip_if_503 ( finagg .bea .api .nipa .get_parameter_list )
You can’t perform that action at this time.
0 commit comments