Created
April 13, 2016 22:28
-
-
Save cneill/2fe86d0b8e5931a2d9ae411114c06bfb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _logTests(self, tests, bucket, status=None): | |
"""Log each test by adding to self.all_tests and the right "bucket" | |
based on the status of the test (e.g. self.aggregated_errors) | |
:param list tests: test results (e.g. test.failures) | |
:param dict bucket: place to store the tests (e.g. self.aggregated_errors) | |
""" | |
for issue in tests: | |
url = issue.request.url | |
method = issue.request.method | |
parts = six.moves.urllib.parse.urlparse(url) | |
hostname = parts.netloc | |
path = parts.path | |
if hostname not in bucket: | |
bucket[hostname] = {} | |
if method not in bucket[hostname]: | |
bucket[hostname][method] = {} | |
method_tests = bucket[hostname][method] | |
if path not in method_tests: | |
method_tests[path] = {} | |
path_tests = method_tests[path] | |
issue_dict = issue.as_dict() | |
if status: | |
issue_dict["status"] = status | |
if issue.test not in path_tests: | |
path_tests[issue.test] = [issue_dict] | |
else: | |
path_tests[issue.test].append(issue_dict) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment