(self, descr)
| 70 | exec(textwrap.dedent(code), globals(), {"self": self}) |
| 71 | |
| 72 | def mkhier(self, descr): |
| 73 | root = tempfile.mkdtemp() |
| 74 | sys.path.insert(0, root) |
| 75 | if not os.path.isdir(root): |
| 76 | os.mkdir(root) |
| 77 | for name, contents in descr: |
| 78 | comps = name.split() |
| 79 | self.modules_to_cleanup.add('.'.join(comps)) |
| 80 | fullname = root |
| 81 | for c in comps: |
| 82 | fullname = os.path.join(fullname, c) |
| 83 | if contents is None: |
| 84 | os.mkdir(fullname) |
| 85 | else: |
| 86 | with open(fullname, "w") as f: |
| 87 | f.write(contents) |
| 88 | if not contents.endswith('\n'): |
| 89 | f.write('\n') |
| 90 | self.root = root |
| 91 | # package name is the name of the first item |
| 92 | self.pkgname = descr[0][0] |
| 93 | |
| 94 | def test_1(self): |
| 95 | hier = [("t1", None), ("t1 __init__.py", "")] |
no test coverage detected