File: conftest.py

package info (click to toggle)
python-baron 0.10.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,080 kB
  • sloc: python: 26,926; makefile: 126; sh: 27
file content (12 lines) | stat: -rw-r--r-- 405 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
import os
import json


def pytest_assertrepr_compare(config, op, left, right):
    if isinstance(left, list) and isinstance(right, list) and op == "==":
        with open("/tmp/a", "w") as a:
            a.write(json.dumps(left, indent=4, sort_keys=True))
        with open("/tmp/b", "w") as b:
            b.write(json.dumps(right, indent=4, sort_keys=True))

        os.system("diff -y /tmp/a /tmp/b")