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

Test case failures in Python 3.8 #132

Open
tirkarthi opened this issue Jun 29, 2019 · 3 comments
Open

Test case failures in Python 3.8 #132

tirkarthi opened this issue Jun 29, 2019 · 3 comments

Comments

@tirkarthi
Copy link

There are some test failures in CPython master and also 3.8 beta 1. I guess the CI could be using an older version of 3.8. I tried some bisecting and on reverting changes made in https://bugs.python.org/issue36996 some cases are fixed. Recently unittest.mock.patch has support added for async functions to be mocked. I am not sure if asynctest tests needs to be changed or if there is a regression due to the linked CPython issue. I have filed DeprecationWarnings in Python 3.8 under #126 since it's of low priority. Test run log as below.

Thanks for asynctest that helped in AsyncMock design :)

python -Wignore -m unittest test
......................................F..E..................................................................................................................................................................................
======================================================================
ERROR: test_create_autospec_on_coroutine_and_using_assert_methods (test.test_mock.Test_CoroutineMock_awaited)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/karthi/asynctest/asynctest/case.py", line 297, in run
    self._run_test_method(testMethod)
  File "/home/karthi/asynctest/asynctest/case.py", line 354, in _run_test_method
    self.loop.run_until_complete(result)
  File "/home/karthi/asynctest/asynctest/case.py", line 224, in wrapper
    return method(*args, **kwargs)
  File "/home/karthi/cpython/Lib/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "/home/karthi/asynctest/test/test_mock.py", line 776, in test_create_autospec_on_coroutine_and_using_assert_methods
    yield from mock("arg0", "arg1", "arg2")
TypeError: cannot 'yield from' a coroutine object in a non-coroutine generator

======================================================================
FAIL: test_awaited_from_autospec_mock (test.test_mock.Test_CoroutineMock_awaited)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/karthi/asynctest/asynctest/case.py", line 297, in run
    self._run_test_method(testMethod)
  File "/home/karthi/asynctest/asynctest/case.py", line 354, in _run_test_method
    self.loop.run_until_complete(result)
  File "/home/karthi/asynctest/asynctest/case.py", line 224, in wrapper
    return method(*args, **kwargs)
  File "/home/karthi/cpython/Lib/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "/home/karthi/asynctest/test/test_mock.py", line 571, in test_awaited_from_autospec_mock
    self.assertFalse(mock.a_coroutine.awaited)
AssertionError: <unittest.mock._AwaitEvent object at 0x7f58e9e5e3c0> is not false

======================================================================
FAIL: test_patch_coroutine_with_multiple_scopes (test.test_mock.Test_patch_decorator_coroutine_or_generator_scope) [new style coroutine - Outer: GLOBAL, inner: LIMITED]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/karthi/asynctest/test/test_mock.py", line 1800, in test_patch_coroutine_with_multiple_scopes
    run_coroutine(tester(a_native_coroutine))
  File "/home/karthi/asynctest/test/utils.py", line 9, in run_coroutine
    return loop.run_until_complete(coroutine)
  File "/home/karthi/cpython/Lib/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "/home/karthi/asynctest/test/test_mock.py", line 1764, in tester
    self.assertEqual((True, False), fut.result())
AssertionError: Tuples differ: (True, False) != (True, True)

First differing element 1:
False
True

- (True, False)
+ (True, True)

======================================================================
FAIL: test_patch_coroutine_with_multiple_scopes (test.test_mock.Test_patch_decorator_coroutine_or_generator_scope) [new style coroutine - Outer: LIMITED, inner: GLOBAL]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/karthi/asynctest/test/test_mock.py", line 1811, in test_patch_coroutine_with_multiple_scopes
    run_coroutine(tester(a_native_coroutine))
  File "/home/karthi/asynctest/test/utils.py", line 9, in run_coroutine
    return loop.run_until_complete(coroutine)
  File "/home/karthi/cpython/Lib/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "/home/karthi/asynctest/test/test_mock.py", line 1764, in tester
    self.assertEqual((True, False), fut.result())
AssertionError: Tuples differ: (True, False) != (True, True)

First differing element 1:
False
True

- (True, False)
+ (True, True)

======================================================================
FAIL: test_multiple_patches_on_coroutine (test.test_mock.Test_patch_decorator_coroutine_or_generator_scope_LIMITED) [new style coroutine]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/karthi/asynctest/test/test_mock.py", line 2088, in test_multiple_patches_on_coroutine
    run_coroutine(tester(a_native_coroutine))
  File "/home/karthi/asynctest/test/utils.py", line 9, in run_coroutine
    return loop.run_until_complete(coroutine)
  File "/home/karthi/cpython/Lib/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "/home/karthi/asynctest/test/test_mock.py", line 2063, in tester
    self.assertEqual((False, False), fut.result())
AssertionError: Tuples differ: (False, False) != (True, True)

First differing element 0:
False
True

- (False, False)
+ (True, True)

======================================================================
FAIL: test_patch_coroutine_only_when_running (test.test_mock.Test_patch_decorator_coroutine_or_generator_scope_LIMITED) [new style coroutine]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/karthi/asynctest/test/test_mock.py", line 2036, in test_patch_coroutine_only_when_running
    run_coroutine(tester(a_native_coroutine))
  File "/home/karthi/asynctest/test/utils.py", line 9, in run_coroutine
    return loop.run_until_complete(coroutine)
  File "/home/karthi/cpython/Lib/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "/home/karthi/asynctest/test/test_mock.py", line 2015, in tester
    self.assertFalse(fut.result())
AssertionError: True is not false

----------------------------------------------------------------------
Ran 223 tests in 1.293s

FAILED (failures=5, errors=1)
@rathann
Copy link

rathann commented Nov 18, 2019

Any progress here? Fedora 32 is going to ship with Python 3.8 and it'd be great to have a package that passes all tests by Beta Freeze latest (late February 2020).

@mgorny
Copy link

mgorny commented Apr 27, 2020

Ping. Is this package alive?

@Martiusweb
Copy link
Owner

Martiusweb commented Apr 30, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants