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
12 test_prog_path = find_in_path('rm.py')
13 if not test_prog_path:
14 sys.exit("Cannot find rm.py in %s" % os.environ["PATH"])
18 create_files(['test1', 'test2'])
19 assert_files_exist(['test1', 'test2'])
20 assert subprocess.call(
21 [sys.executable, test_prog_path, "test2"]) == 0
22 assert_files_exist('test1')
23 assert_files_not_exist('test2')
25 create_files(['test1', 'test2'])
26 assert_files_exist(['test1', 'test2'])
27 assert subprocess.call(
28 [sys.executable, test_prog_path, "-r", "test2"]) == 0
29 assert_files_exist('test1')
30 assert_files_not_exist('test2')
33 def test_rm_recursive():
34 create_files(['test'])
35 create_files(['test'], 'subdir/subd2')
36 assert_files_exist(['test', 'subdir/subd2/test'])
37 assert subprocess.call(
38 [sys.executable, test_prog_path, "subdir"]) == 1
39 assert subprocess.call(
40 [sys.executable, test_prog_path, "-r", "subdir"]) == 0
41 assert_files_exist('test')
42 assert_files_not_exist(['subdir/subd2/test'])