|
4 | 4 | import os |
5 | 5 | import shutil |
6 | 6 | from contextlib import suppress |
| 7 | +from pathlib import Path |
7 | 8 |
|
8 | 9 | import log |
9 | 10 | import pytest |
@@ -74,7 +75,7 @@ def config(): |
74 | 75 | os.makedirs(TMP) |
75 | 76 | os.chdir(TMP) |
76 | 77 |
|
77 | | - os.system("touch .git") |
| 78 | + Path(".git").touch() |
78 | 79 | config = Config(root=TMP) |
79 | 80 | config.datafile.text = CONFIG |
80 | 81 | config.datafile.load() |
@@ -258,20 +259,20 @@ def it_should_create_links(config_with_link): |
258 | 259 | expect(os.listdir()).contains("my_link") |
259 | 260 |
|
260 | 261 | def it_should_not_overwrite_files(config_with_link): |
261 | | - os.system("touch my_link") |
| 262 | + Path("my_link").touch() |
262 | 263 |
|
263 | 264 | with pytest.raises(RuntimeError): |
264 | 265 | gitman.install(depth=1) |
265 | 266 |
|
266 | 267 | def it_should_not_overwrite_non_empty_directories(config_with_link): |
267 | | - os.system("mkdir my_link") |
268 | | - os.system("touch mylink/my_link") |
| 268 | + os.mkdir("my_link") |
| 269 | + Path("my_link/my_link").touch() |
269 | 270 |
|
270 | 271 | with pytest.raises(RuntimeError): |
271 | 272 | gitman.install(depth=1) |
272 | 273 |
|
273 | 274 | def it_overwrites_files_with_force(config_with_link): |
274 | | - os.system("touch my_link") |
| 275 | + Path("my_link").touch() |
275 | 276 |
|
276 | 277 | expect(gitman.install(depth=1, force=True)) == True |
277 | 278 |
|
@@ -307,20 +308,20 @@ def it_should_create_links(config_with_links): |
307 | 308 | expect(os.listdir()).contains("gmd_4") |
308 | 309 |
|
309 | 310 | def it_should_not_overwrite_files(config_with_links): |
310 | | - os.system("touch gmd_3") |
| 311 | + Path("gmd_3").touch() |
311 | 312 |
|
312 | 313 | with pytest.raises(RuntimeError): |
313 | 314 | gitman.install(depth=1) |
314 | 315 |
|
315 | 316 | def it_should_not_overwrite_non_empty_directories(config_with_links): |
316 | | - os.system("mkdir gmd_3") |
317 | | - os.system("touch gmd_3/my_link") |
| 317 | + os.mkdir("gmd_3") |
| 318 | + Path("gmd_3/my_link").touch() |
318 | 319 |
|
319 | 320 | with pytest.raises(RuntimeError): |
320 | 321 | gitman.install(depth=1) |
321 | 322 |
|
322 | 323 | def it_overwrites_files_with_force(config_with_links): |
323 | | - os.system("touch gmd_3") |
| 324 | + Path("gmd_3").touch() |
324 | 325 |
|
325 | 326 | expect(gitman.install(depth=1, force=True)) == True |
326 | 327 |
|
|
0 commit comments