File tree Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -42,21 +42,30 @@ def get_text_files(directory):
42
42
def detect_installed_file (current_file , test_files ):
43
43
"""Returns the file in <test_files> which is contained in
44
44
<current_file>, or "Unknown"."""
45
- current = open (current_file ).read ()
46
- for f in test_files :
47
- tested = open (f ).read ()
48
- if tested in current :
49
- return f
45
+ try :
46
+ current = open (current_file ).read ()
47
+ for f in test_files :
48
+ tested = open (f ).read ()
49
+ if tested in current :
50
+ return f
51
+ except IOError :
52
+ pass
50
53
return "Unknown"
51
54
52
55
def detect_installed_files (current_file , test_files ):
53
56
"""Returns a list of files in <test_files> that are contained in
54
57
<current_file>."""
55
- current = open (current_file ).read ()
56
58
installed = []
57
- for f in test_files :
58
- tested = open (f ).read ()
59
- if tested in current :
60
- installed .append (f )
59
+ try :
60
+ current = open (current_file ).read ()
61
+ for f in test_files :
62
+ try :
63
+ tested = open (f ).read ()
64
+ if tested in current :
65
+ installed .append (f )
66
+ except IOError :
67
+ pass
68
+ except IOError :
69
+ pass
61
70
return installed
62
71
You can’t perform that action at this time.
0 commit comments