@@ -68,9 +68,8 @@ def test_export_json(self):
68
68
69
69
json_config_data = configparser .export ('json' , indent = 2 )
70
70
71
- buf = open (json_config_file , 'w' )
72
- buf .write (json_config_data )
73
- buf .close ()
71
+ with open (json_config_file , 'w' ) as buf :
72
+ buf .write (json_config_data )
74
73
75
74
new_config = kaptan .Kaptan ()
76
75
new_config_data = new_config .import_config (json_config_file ).get ()
@@ -86,9 +85,8 @@ def test_export_yaml(self):
86
85
yaml_config_data = configparser .export (
87
86
'yaml' , indent = 2 , default_flow_style = False )
88
87
89
- buf = open (yaml_config_file , 'w' )
90
- buf .write (yaml_config_data )
91
- buf .close ()
88
+ with open (yaml_config_file , 'w' ) as buf :
89
+ buf .write (yaml_config_data )
92
90
93
91
new_config = kaptan .Kaptan ()
94
92
new_config_data = new_config .import_config (yaml_config_file ).get ()
@@ -98,9 +96,8 @@ def test_scan_config(self):
98
96
configs = []
99
97
100
98
garbage_file = os .path .join (TMUXP_DIR , 'config.psd' )
101
- buf = open (garbage_file , 'w' )
102
- buf .write ('wat' )
103
- buf .close ()
99
+ with open (garbage_file , 'w' ) as buf :
100
+ buf .write ('wat' )
104
101
105
102
if os .path .exists (TMUXP_DIR ):
106
103
for r , d , f in os .walk (TMUXP_DIR ):
0 commit comments