5 from ppu_tu import setup, teardown, find_in_path # noqa
6 from ppu_tu import create_files, assert_files_exist, assert_files_not_exist
9 test_prog_path = find_in_path('rm.py')
13 create_files(['test1', 'test2'])
14 assert_files_exist(['test1', 'test2'])
15 assert subprocess.call(
16 [sys.executable, test_prog_path, "test2"]) == 0
17 assert_files_exist('test1')
18 assert_files_not_exist('test2')
20 create_files(['test1', 'test2'])
21 assert_files_exist(['test1', 'test2'])
22 assert subprocess.call(
23 [sys.executable, test_prog_path, "-r", "test2"]) == 0
24 assert_files_exist('test1')
25 assert_files_not_exist('test2')
28 def test_rm_recursive():
29 create_files(['test'])
30 create_files(['test'], 'subdir/subd2')
31 assert_files_exist(['test', 'subdir/subd2/test'])
32 assert subprocess.call(
33 [sys.executable, test_prog_path, "subdir"]) == 1
34 assert subprocess.call(
35 [sys.executable, test_prog_path, "-r", "subdir"]) == 0
36 assert_files_exist('test')
37 assert_files_not_exist(['subdir/subd2/test'])