summaryrefslogtreecommitdiff
path: root/test/coveragetest.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/coveragetest.py')
-rw-r--r--test/coveragetest.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/coveragetest.py b/test/coveragetest.py
index 8e15e49d..981beeea 100644
--- a/test/coveragetest.py
+++ b/test/coveragetest.py
@@ -116,13 +116,19 @@ class CoverageTest(TestCase):
def make_file(self, filename, text):
"""Create a temp file.
- `filename` is the file name, and `text` is the content.
+ `filename` is the path to the file, including directories if desired,
+ and `text` is the content.
"""
# Tests that call `make_file` should be run in a temp environment.
assert self.run_in_temp_dir
text = textwrap.dedent(text)
+ # Make sure the directories are available.
+ dirs, _ = os.path.split(filename)
+ if dirs and not os.path.exists(dirs):
+ os.makedirs(dirs)
+
# Create the file.
f = open(filename, 'w')
f.write(text)