approvals / ApprovalTests.Python

ApprovalTests for python
Apache License 2.0
147 stars 52 forks source link

support inline approvals on cyber-dojo #159

Open nitsanavni opened 7 months ago

nitsanavni commented 7 months ago

doesn't quite work as expected yet, see here - https://cyber-dojo.org/kata/edit/b0U7pS

nitsanavni commented 7 months ago

experimenting with cyber-dojo + inline approvals + auto-approval https://cyber-dojo.org/kata/edit/US1feV

(almost works)

nitsanavni commented 5 months ago

Found the problem:

We're doing a shallow file compare (only comparing stats), and if the received is the exact length as approved we get a false positive.

https://github.com/approvals/ApprovalTests.Python/blob/2bdb007503f4863728413df996bc588c32402a60/approvaltests/file_approver.py#L26

for inline in cyber-dojo this line should be:

if filecmp.cmp(approved_path, received_path, shallow=is_not_cyber_dojo()):

see here: https://cyber-dojo.org/kata/edit/bHvRz1

nitsanavni commented 5 months ago

update: fixed in latest release

now waiting to be merged to cyberdojo https://github.com/cyber-dojo-languages/python-approval-pytest/pull/4 https://github.com/cyber-dojo-languages/python-approval-unittest/pull/4