Skip to content

Commit 145283f

Browse files
sseliverstovbaev
authored andcommitted
skip None and empty values (fixes #1)
1 parent 4a1a48f commit 145283f

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

‎allure-pytest/src/model2.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
def _write(report_dir, item, glob):
1515
filename = glob.format(prefix=uuid.uuid4())
16-
data = asdict(item)
16+
data = asdict(item, filter=lambda attr, value: not (type(value) != bool and not bool(value)))
1717
with io.open(os.path.join(report_dir, filename), 'w', encoding='utf-8') as file:
1818
file.write(unicode(json.dumps(data, indent=4, ensure_ascii=False)))
1919

‎allure-pytest/test/matchers/item.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,11 @@ def has_attachment(attachment_type, name=None):
110110
all_of(
111111
has_entry('source', anything()),
112112
has_entry('type', attachment_type),
113-
has_entry('name', name if name else anything())
113+
has_entry('name', name) if name else anything()
114114
)
115115
))
116116

117117

118-
119118
def with_id():
120119
return has_entry('id', not_none())
121120

0 commit comments

Comments
 (0)