You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @Martiusweb ,
First of all thanks for this library. This has really helped in unit testing with aiohttp.
I faced an issue while running parameterized testing using ddt.
================================================================ test session starts =================================================================
platform linux -- Python 3.6.7, pytest-4.2.0, py-1.8.0, pluggy-0.11.0 -- /home/vinaysharma/work/new/survey/venv/bin/python3
rootdir: /home/vinaysharma/work/new/survey, inifile: pytest.ini
plugins: cov-2.6.1, asyncio-0.10.0, aiohttp-0.3.0
collected 4 items
check_ddt.py::Data::test_func_one_1
------------------------------------------------------------------- live log call --------------------------------------------------------------------
selector_events.py 65 DEBUG Using selector: EpollSelector
<MagicMock name='getcwd' id='140009124050536'>
{'a': 'b'} 54759eb3c090d83494e2d804
PASSED
check_ddt.py::Data::test_func_one_2
------------------------------------------------------------------- live log call --------------------------------------------------------------------
selector_events.py 65 DEBUG Using selector: EpollSelector
<MagicMock name='getcwd' id='140009124050536'>
{'a': 1} 54759eb3c090d83494e2d804
PASSED
check_ddt.py::Data::test_func_two_1
------------------------------------------------------------------- live log call --------------------------------------------------------------------
selector_events.py 65 DEBUG Using selector: EpollSelector
<MagicMock name='getcwd' id='140009121942720'>
{'a': 'b'} 54759eb3c090d83494e2d804
PASSED
check_ddt.py::Data::test_func_two_2
------------------------------------------------------------------- live log call --------------------------------------------------------------------
selector_events.py 65 DEBUG Using selector: EpollSelector
<MagicMock name='getcwd' id='140009121998384'>
{'a': 1} 54759eb3c090d83494e2d804
PASSED
============================================================== 4 passed in 0.05 seconds ==============================================================
Run Using following command: pytest -p no:cacheprovider -s test.py
As you can see ddt adds more functions to the class, causing the total number of functions to be 4.
But the first and second function both have same MagicMock Instance, which causes problems with self.assert_called_once().
I have validated that this is not an issue with ddt, because all they do is add new functions to the class.
Also, this error only occurs if using the async keyword before def.
Replicated on asynctest 0.13.0 and 0.12.4.
I would be very grateful if you could look into it.
The text was updated successfully, but these errors were encountered:
Hi @Martiusweb ,
First of all thanks for this library. This has really helped in unit testing with aiohttp.
I faced an issue while running parameterized testing using ddt.
Let's say I have following tests:
I get the following output:
Run Using following command:
pytest -p no:cacheprovider -s test.py
As you can see ddt adds more functions to the class, causing the total number of functions to be 4.
But the first and second function both have same MagicMock Instance, which causes problems with
self.assert_called_once()
.I have validated that this is not an issue with
ddt
, because all they do is add new functions to the class.Also, this error only occurs if using the
async
keyword beforedef
.Replicated on asynctest 0.13.0 and 0.12.4.
I would be very grateful if you could look into it.
The text was updated successfully, but these errors were encountered: