Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flexmock doesn't work correctly with unittest.expectedFailure #112

Open
ollipa opened this issue Nov 18, 2021 · 0 comments
Open

Flexmock doesn't work correctly with unittest.expectedFailure #112

ollipa opened this issue Nov 18, 2021 · 0 comments
Labels

Comments

@ollipa
Copy link
Member

ollipa commented Nov 18, 2021

Flexmock doesn't work correctly with unittest.expectedFailure decorator. If a test is marked with expectedFailure and flexmock assertions fail, the test fails due to unexpected success.

https://docs.python.org/3/library/unittest.html#unittest.expectedFailure

We should hook flexmock into addUnexpectedSuccess and addExpectedFailure.

Test case to reproduce the issue:

import unittest

from flexmock import flexmock


class TestExpectedFailure(unittest.TestCase):
    @unittest.expectedFailure
    def test_expected_failure(self):
        flexmock().should_receive("failed").once()

Running the above code produces the following output:

> python -m unittest tests/test_unittest.py
u
----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (unexpected successes=1)
@ollipa ollipa added the bug label Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant