Created
August 6, 2019 22:50
-
-
Save colinfwren/a10b9fd79ecada85c73951bf04399170 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
""" | |
self.cycle - Test Cycle Instance | |
self.test_executions - Test Execution collection | |
""" | |
def pytest_terminal_summary(self, terminalreporter, exitstatus, config): | |
if exitstatus == 0: | |
self.cycle.execution_status = 'Passed' | |
if exitstatus == 1: | |
self.cycle.execution_status = 'Failed' | |
exec_records = self.test_executions.collection.get_rows() | |
test_exec_prop = [item for item in exec_records[0].schema if item.get('slug') == 'test_cycle'][0] | |
filter = [ | |
{ | |
'property': test_exec_prop.get('id'), | |
'comparator': 'enum_contains', | |
'value': self.cycle.id, | |
'type': 'relation' | |
} | |
] | |
cvb = self.cycle.children.add_new(CollectionViewBlock) | |
view = self.notion.get_collection_view(self.notion.create_record("collection_view", parent=cvb, type="board"), collection=self.test_executions.collection) | |
view.set("collection_id", self.test_executions.collection.id) | |
cvb.set("collection_id", self.test_executions.collection.id) | |
cvb.set("view_ids", [view.id]) | |
cvb.title = "Test Executions" | |
view.set('query.filter', filter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment