Create a .pth file with a comment, blank lines, an ``import ``, a line with self.good_dirname, and a line with self.bad_dirname. Creation of the directory for self.good_dir_path (based off of self.good_dirname) is also performed. Make sure to
(self)
| 416 | self.bad_dir_path = os.path.join(self.base_dir, self.bad_dirname) |
| 417 | |
| 418 | def create(self): |
| 419 | """Create a .pth file with a comment, blank lines, an ``import |
| 420 | <self.imported>``, a line with self.good_dirname, and a line with |
| 421 | self.bad_dirname. |
| 422 | |
| 423 | Creation of the directory for self.good_dir_path (based off of |
| 424 | self.good_dirname) is also performed. |
| 425 | |
| 426 | Make sure to call self.cleanup() to undo anything done by this method. |
| 427 | |
| 428 | """ |
| 429 | FILE = open(self.file_path, 'w') |
| 430 | try: |
| 431 | print("#import @bad module name", file=FILE) |
| 432 | print("\n", file=FILE) |
| 433 | print("import %s" % self.imported, file=FILE) |
| 434 | print(self.good_dirname, file=FILE) |
| 435 | print(self.bad_dirname, file=FILE) |
| 436 | finally: |
| 437 | FILE.close() |
| 438 | os.mkdir(self.good_dir_path) |
| 439 | |
| 440 | def cleanup(self, prep=False): |
| 441 | """Make sure that the .pth file is deleted, self.imported is not in |
no test coverage detected