(
self,
logger,
start_at,
start_dir,
resume=False,
only=False,
skip=False,
abort_on_error=True,
coverage=False,
max_failures=None,
)
| 41 | ) |
| 42 | |
| 43 | def __init__( |
| 44 | self, |
| 45 | logger, |
| 46 | start_at, |
| 47 | start_dir, |
| 48 | resume=False, |
| 49 | only=False, |
| 50 | skip=False, |
| 51 | abort_on_error=True, |
| 52 | coverage=False, |
| 53 | max_failures=None, |
| 54 | ): |
| 55 | self.active = False |
| 56 | self.start_at = start_at |
| 57 | self.only = only |
| 58 | self.skip = skip |
| 59 | self.coverage = coverage |
| 60 | self.had_match = False |
| 61 | self.abort_on_error = abort_on_error |
| 62 | self.max_failures = max_failures |
| 63 | |
| 64 | self.start_dir = start_dir |
| 65 | self.logger = logger |
| 66 | self.may_fail = [] |
| 67 | |
| 68 | if only and not abort_on_error: |
| 69 | self.logger.sysexit("Error, cannot combine --only-one and --all.") |
| 70 | |
| 71 | self.verifications = 0 |
| 72 | self.failed = [] |
| 73 | |
| 74 | # We are going to produce a hash from the command line script we are running, |
| 75 | # so we have a unique place to store the resume state. |
| 76 | tests_path = os.path.normcase(os.path.abspath(sys.modules["__main__"].__file__)) |
| 77 | version = sys.version |
| 78 | |
| 79 | if str is not bytes: |
| 80 | tests_path = tests_path.encode("utf8") |
| 81 | version = version.encode("utf8") |
| 82 | |
| 83 | case_hash = md5(tests_path) |
| 84 | case_hash.update(version) |
| 85 | |
| 86 | from .Common import getTestingCacheDir |
| 87 | |
| 88 | cache_filename = os.path.join(getTestingCacheDir(), case_hash.hexdigest()) |
| 89 | |
| 90 | self.cache_filename = cache_filename |
| 91 | |
| 92 | if resume and os.path.exists(cache_filename): |
| 93 | self.resume_from = getFileContents(cache_filename) or None |
| 94 | else: |
| 95 | self.resume_from = None |
| 96 | |
| 97 | def consider(self, dirname, filename): |
| 98 | if self.active and self.only: |
nothing calls this directly
no test coverage detected