8000 PyCharm diff comparison failure doesn't work with custom classes · Issue #675 · syrupy-project/syrupy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
PyCharm diff comparison failure doesn't work with custom classes #675
Closed
@lindenwells

Description

@lindenwells

Describe the bug

When comparing a failed snapshot test on an object without a custom __repr__ (i.e. relies on syrupy's serializer), PyCharm incorrectly displays the actual output as the default __repr__ (e.g. ...Mansion object at 0xBEEF2020) instead of what syrupy serialises it to (e.g. Mansion(rooms=[Room(...)])).

This might be a PyCharm bug, or Syrupy or somehow both. Just thought I'd make this issue as it tripped me up at work for over an hour and I imagine a fair few people use PyCharm and syrupy together.

To reproduce

  1. checkout this repo I made
  2. create a virtualenv within and pip install syrupy==3.0.2
  3. find the singular test within the run configurations and notice that it fails.
  4. in the failed test output, scroll to the clickable '<Click to see difference>' text: image
  5. click that text and you should get a Comparison Failure interface like this: image

Expected behavior

This is roughly what I should see in the Comparison Failure window.
image
I know this is wrong because when I run pytest --snapshot-update, it updates the snapshot like this.

Screenshots
added throughout where appropriate

Environment:

  • OS: Windows 11 Pro 21H2
  • Syrupy Version: 3.0.2
  • Python Version: 3.9.13
  • PyCharm Version: 2022.3 (Community Edition), Build #PC-223.7571.203, built on December 1, 2022, Runtime version: 17.0.5+1-b653.14 amd64, VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

Additional context

This is similar to #572 but not the same.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0