@@ -30,11 +30,11 @@ def validate_pioproject(pioproject_dir):
3030 )
3131
3232
33- def test_init_default (clirunner , validate_cliresult ):
34- with clirunner . isolated_filesystem ( ):
33+ def test_init_default (clirunner , validate_cliresult , tmp_path ):
34+ with fs . cd ( str ( tmp_path ) ):
3535 result = clirunner .invoke (project_init_cmd )
3636 validate_cliresult (result )
37- validate_pioproject (os . getcwd ( ))
37+ validate_pioproject (str ( tmp_path ))
3838
3939
4040def test_init_duplicated_boards (clirunner , validate_cliresult , tmpdir ):
@@ -129,28 +129,28 @@ def test_init_ide_vscode(clirunner, validate_cliresult, tmpdir):
129129 )
130130
131131
132- def test_init_ide_eclipse (clirunner , validate_cliresult ):
133- with clirunner . isolated_filesystem ( ):
132+ def test_init_ide_eclipse (clirunner , validate_cliresult , tmp_path ):
133+ with fs . cd ( str ( tmp_path ) ):
134134 result = clirunner .invoke (
135135 project_init_cmd ,
136136 ["-b" , "uno" , "--ide" , "eclipse" , "--no-install-dependencies" ],
137137 )
138138 validate_cliresult (result )
139- validate_pioproject (os . getcwd ( ))
139+ validate_pioproject (str ( tmp_path ))
140140 assert all (os .path .isfile (f ) for f in (".cproject" , ".project" ))
141141
142142
143- def test_init_special_board (clirunner , validate_cliresult ):
144- with clirunner . isolated_filesystem ( ):
143+ def test_init_special_board (clirunner , validate_cliresult , tmp_path ):
144+ with fs . cd ( str ( tmp_path ) ):
145145 result = clirunner .invoke (project_init_cmd , ["-b" , "uno" ])
146146 validate_cliresult (result )
147- validate_pioproject (os . getcwd ( ))
147+ validate_pioproject (str ( tmp_path ))
148148
149149 result = clirunner .invoke (cmd_boards , ["Arduino Uno" , "--json-output" ])
150150 validate_cliresult (result )
151151 boards = json .loads (result .output )
152152
153- config = ProjectConfig (os . path . join ( os . getcwd (), "platformio.ini" ))
153+ config = ProjectConfig (str ( tmp_path / "platformio.ini" ))
154154 config .validate ()
155155
156156 expected_result = dict (
@@ -164,8 +164,8 @@ def test_init_special_board(clirunner, validate_cliresult):
164164 )
165165
166166
167- def test_init_enable_auto_uploading (clirunner , validate_cliresult ):
168- with clirunner . isolated_filesystem ( ):
167+ def test_init_enable_auto_uploading (clirunner , validate_cliresult , tmp_path ):
168+ with fs . cd ( str ( tmp_path ) ):
169169 result = clirunner .invoke (
170170 project_init_cmd ,
171171 [
@@ -177,8 +177,8 @@ def test_init_enable_auto_uploading(clirunner, validate_cliresult):
177177 ],
178178 )
179179 validate_cliresult (result )
180- validate_pioproject (os . getcwd ( ))
181- config = ProjectConfig (os . path . join ( os . getcwd (), "platformio.ini" ))
180+ validate_pioproject (str ( tmp_path ))
181+ config = ProjectConfig (str ( tmp_path / "platformio.ini" ))
182182 config .validate ()
183183 expected_result = dict (
184184 targets = ["upload" ], platform = "atmelavr" , board = "uno" , framework = ["arduino" ]
@@ -189,8 +189,8 @@ def test_init_enable_auto_uploading(clirunner, validate_cliresult):
189189 )
190190
191191
192- def test_init_custom_framework (clirunner , validate_cliresult ):
193- with clirunner . isolated_filesystem ( ):
192+ def test_init_custom_framework (clirunner , validate_cliresult , tmp_path ):
193+ with fs . cd ( str ( tmp_path ) ):
194194 result = clirunner .invoke (
195195 project_init_cmd ,
196196 [
@@ -202,8 +202,8 @@ def test_init_custom_framework(clirunner, validate_cliresult):
202202 ],
203203 )
204204 validate_cliresult (result )
205- validate_pioproject (os . getcwd ( ))
206- config = ProjectConfig (os . path . join ( os . getcwd (), "platformio.ini" ))
205+ validate_pioproject (str ( tmp_path ))
206+ config = ProjectConfig (str ( tmp_path / "platformio.ini" ))
207207 config .validate ()
208208 expected_result = dict (platform = "teensy" , board = "teensy31" , framework = ["mbed" ])
209209 assert config .has_section ("env:teensy31" )
0 commit comments