summaryrefslogtreecommitdiff
path: root/coverage/codeunit.py
diff options
context:
space:
mode:
Diffstat (limited to 'coverage/codeunit.py')
-rw-r--r--coverage/codeunit.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/coverage/codeunit.py b/coverage/codeunit.py
index ead6e545..cc72f5c0 100644
--- a/coverage/codeunit.py
+++ b/coverage/codeunit.py
@@ -96,3 +96,7 @@ class CodeUnit:
"""
root = os.path.splitdrive(os.path.splitext(self.name)[0])[1]
return root.replace('\\', '_').replace('/', '_')
+
+ def source_file(self):
+ """Return an open file for reading the source of the code unit."""
+ return open(self.filename)