JetBrains / teamcity-messages

Python Unit Test Reporting to TeamCity
https://pypi.python.org/pypi/teamcity-messages
Apache License 2.0
138 stars 81 forks source link

Parse unitest.mock assertions as diffs #256

Open ikonst opened 3 years ago

ikonst commented 3 years ago

Currently unitest.mock failed assertions are not recognized as "diffs" in PyCharm. This teaches the plugin to recognize those assertions and emit the EqualsAssertionError with the actual/expected.

Additionally: pytest-mock (a popular pytest plugin providing the mocker fixture) has an improved reporting feature which patches unittest.mock and changes the format of the reports.

To work well out of the box, we handle both the stock and "patched" outputs.

For example, this test

def test_foo():
    m = Mock()
    m.foo(41)
    m.foo.assert_called_once_with(42)

would result in this output: image and diff viewer: image

ikonst commented 3 years ago

@throwable-one can take a look?

ikonst commented 2 years ago

@mikekidya can review?

ikonst commented 1 year ago

@mikekidya ping?