(self, info, report=False, debug=0, replace_paths=[], modulefinder_class=modulefinder.ModuleFinder)
| 336 | shutil.rmtree(self.test_dir) |
| 337 | |
| 338 | def _do_test(self, info, report=False, debug=0, replace_paths=[], modulefinder_class=modulefinder.ModuleFinder): |
| 339 | import_this, modules, missing, maybe_missing, source = info |
| 340 | create_package(self.test_dir, source) |
| 341 | mf = modulefinder_class(path=self.test_path, debug=debug, |
| 342 | replace_paths=replace_paths) |
| 343 | mf.import_hook(import_this) |
| 344 | if report: |
| 345 | mf.report() |
| 346 | ## # This wouldn't work in general when executed several times: |
| 347 | ## opath = sys.path[:] |
| 348 | ## sys.path = self.test_path |
| 349 | ## try: |
| 350 | ## __import__(import_this) |
| 351 | ## except: |
| 352 | ## import traceback; traceback.print_exc() |
| 353 | ## sys.path = opath |
| 354 | ## return |
| 355 | modules = sorted(set(modules)) |
| 356 | found = sorted(mf.modules) |
| 357 | # check if we found what we expected, not more, not less |
| 358 | self.assertEqual(found, modules) |
| 359 | |
| 360 | # check for missing and maybe missing modules |
| 361 | bad, maybe = mf.any_missing_maybe() |
| 362 | self.assertEqual(bad, missing) |
| 363 | self.assertEqual(maybe, maybe_missing) |
| 364 | |
| 365 | def test_package(self): |
| 366 | self._do_test(package_test) |
no test coverage detected