git-machete
git-machete copied to clipboard
Failed `assert ... == ...` in tests doesn't seem to show the actual value
A sample failure (I tried to run the test newly-added on #594 against code without client.py
changed):
================================================================================================================== FAILURES ==================================================================================================================
_______________________________________________________________________________ TestStatus.test_status_when_child_branch_is_pushed_immediately_after_creation ________________________________________________________________________________
[gw0] linux -- Python 3.10.5 /home/plipski/git-machete/.tox/py310/bin/python
self = <tests.test_status.TestStatus object at 0x7f2cbe406e60>, mocker = <pytest_mock.plugin.MockerFixture object at 0x7f2cbe4105e0>
def test_status_when_child_branch_is_pushed_immediately_after_creation(self, mocker: Any) -> None:
mocker.patch('git_machete.utils.run_cmd', mock_run_cmd) # to hide git outputs in tests
(
self.repo_sandbox.new_branch("master")
.commit("master")
.push()
.new_branch("foo")
.commit("foo")
.new_branch("bar")
.push()
.commit("bar")
)
launch_command('discover', '-y')
expected_status_output = (
"""
master
|
o-foo (untracked)
|
o-bar * (ahead of origin)
"""
)
> assert_command(['status'], expected_status_output)
/home/plipski/git-machete/tests/test_status.py:309:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmds = ['status'], expected_result = ' master\n |\n o-foo (untracked)\n |\n o-bar * (ahead of origin)\n', strip_indentation = True, indent = ' '
def assert_command(cmds: Iterable[str], expected_result: str, strip_indentation: bool = True, indent: str = ' ') -> None:
expected_result = adapt(expected_result, indent) if strip_indentation else expected_result
> assert launch_command(*cmds) == expected_result
E AssertionError
/home/plipski/git-machete/tests/mockers.py:356: AssertionError
I can see no clue as to what's the actual result ://
@AABur do you have any clue what's wrong? is it expected?
@PawelLipski Give me a couple of days - I'll see what the problem is
@PawelLipski issue still open? I ran the tests and didn't get this error.
This partiular error is just an example, it does not happen on develop... the problem described in this issue is that when any assert
fails, then there is no clue as to what the side of the comparison were :/