2

I'm trying to implement async unit tests running with usage of pyodide library. Synchronous tests work just fine, I have a problem with async tests. I created a class definition where I'm placing all tests something like

from unittest import IsolatedAsyncioTestCase

class TestClass(IsolatedAsyncioTestCase):

    async def test_case_one(self):
        print('hello')
        result = await functionality()
        self.assertEqual(expected, result)

I have to run it through runner which is working fine for synchronous code but I have an error running it with async code:

import unittest
from pprint import pprint

runner = unittest.TextTestRunner()
result = runner.run(unittest.makeSuite(TestClass))

after execution of this code I'm receiving this error: enter image description here

Everything is working fine if I'm not using IsolatedAsyncioTestCase in my TestClass but TestCase but this is for synchronous code.

Is there anything I'm doing wrong? This is the pyodide console which I'm using: https://pyodide.org/en/latest/console.html Thank you for response

whiteBear22
  • 377
  • 2
  • 8
  • 21

0 Answers0