1212
1313
1414def load_test_fixture (fixture_path ):
15- path = os .path .dirname (os .path .abspath (__file__ ))
16- with open (path + "/" + fixture_path ) as fixture_file :
15+ tests_dir = os .path .dirname (os .path .abspath (__file__ ))
16+ file_path = os .path .join (tests_dir , fixture_path )
17+ with open (file_path ) as fixture_file :
1718 input = fixture_file .read ()
1819 sys .stdin = StringIO (input )
1920 sys .stdout = StringIO ()
2021
2122
2223class TestMinimalConfig (unittest .TestCase ):
2324 def setUp (self ):
24- load_test_fixture ("fixtures/test-minimal-config.json" )
25+ fixture_path = os .path .join ("fixtures" , "test-minimal-config.json" )
26+ load_test_fixture (fixture_path )
2527 self .analyzer = Analyzer ()
2628
2729 def test_default_config (self ):
@@ -43,7 +45,8 @@ def test_params_data(self):
4345
4446class TestProxyConfig (unittest .TestCase ):
4547 def setUp (self ):
46- load_test_fixture ("fixtures/test-proxy-config.json" )
48+ fixture_path = os .path .join ("fixtures" , "test-proxy-config.json" )
49+ load_test_fixture (fixture_path )
4750 self .analyzer = Analyzer ()
4851
4952 def test_proxy_config (self ):
@@ -58,7 +61,8 @@ def test_proxy_config(self):
5861
5962class TestTlpConfig (unittest .TestCase ):
6063 def setUp (self ):
61- load_test_fixture ("fixtures/test-tlp-config.json" )
64+ fixture_path = os .path .join ("fixtures" , "test-tlp-config.json" )
65+ load_test_fixture (fixture_path )
6266 self .analyzer = Analyzer ()
6367
6468 def test_check_tlp_disabled (self ):
@@ -89,7 +93,8 @@ def test_check_tlp_ok(self):
8993
9094class TestErrorResponse (unittest .TestCase ):
9195 def setUp (self ):
92- load_test_fixture ("fixtures/test-error-response.json" )
96+ fixture_path = os .path .join ("fixtures" , "test-error-response.json" )
97+ load_test_fixture (fixture_path )
9398 self .analyzer = Analyzer ()
9499
95100 def test_error_response (self ):
@@ -124,7 +129,8 @@ def test_error_response(self):
124129
125130class TestReportResponse (unittest .TestCase ):
126131 def setUp (self ):
127- load_test_fixture ("fixtures/test-report-response.json" )
132+ fixture_path = os .path .join ("fixtures" , "test-report-response.json" )
133+ load_test_fixture (fixture_path )
128134 self .analyzer = Analyzer ()
129135
130136 def test_report_response (self ):
0 commit comments