6 from ppu_tu import setup, teardown, find_in_path # noqa
7 from ppu_tu import create_files, assert_files_exist, assert_files_not_exist
10 test_prog_path = find_in_path('rm.py')
11 if not test_prog_path:
12 sys.exit("Cannot find rm.py in %s" % os.environ["PATH"])
16 create_files(['test1', 'test2'])
17 assert_files_exist(['test1', 'test2'])
18 assert subprocess.call(
19 [sys.executable, test_prog_path, "test2"]) == 0
20 assert_files_exist('test1')
21 assert_files_not_exist('test2')
23 create_files(['test1', 'test2'])
24 assert_files_exist(['test1', 'test2'])
25 assert subprocess.call(
26 [sys.executable, test_prog_path, "-r", "test2"]) == 0
27 assert_files_exist('test1')
28 assert_files_not_exist('test2')
31 def test_rm_recursive():
32 create_files(['test'])
33 create_files(['test'], 'subdir/subd2')
34 assert_files_exist(['test', 'subdir/subd2/test'])
35 assert subprocess.call(
36 [sys.executable, test_prog_path, "subdir"]) == 1
37 assert subprocess.call(
38 [sys.executable, test_prog_path, "-r", "subdir"]) == 0
39 assert_files_exist('test')
40 assert_files_not_exist(['subdir/subd2/test'])