Skip to content

Commit 62834d2

Browse files
committed
Re-raise the error when failing loading a python script.
This helps to avoid silent errors during the modules loading when running RLTest both, locally and in CI. Also catches the more generic OSError when attemping to load a file.
1 parent f1a2652 commit 62834d2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

RLTest/loader.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,12 @@ def load_files(self, module_dir, module_name, toplevel_filter=None, subfilter=No
132132
self.tests.append(TestClass(filename, symbol, module_name, methnames))
133133
elif inspect.isfunction(obj):
134134
self.tests.append(TestFunction(filename, symbol, module_name))
135-
except FileNotFoundError:
136-
print(Colors.Red("File %s not found: skipping" % filename))
137-
except Exception as x:
138-
print(Colors.Red("Problems in file %s: %s" % (filename, x)))
135+
except OSError as e:
136+
print(Colors.Red("Can't access file %s." % filename))
137+
raise e
138+
except Exception as e:
139+
print(Colors.Red("Problems in file %s: %s" % (filename, e)))
140+
raise e
139141

140142
def scan_dir(self, testdir):
141143
for filename in os.listdir(testdir):

0 commit comments

Comments
 (0)