Duroktar / Wolf

Wolf is a VsCode extension that enables live inspection of Python code in the editor.
Other
128 stars 7 forks source link

wolf doesn't work with unittest #57

Open Almenon opened 3 years ago

Almenon commented 3 years ago

99 bugs left on the wall, take two down, pass them around, 99 bugs left on the wall!

But seriously, it's getting harder to find bugs now, so you're making progress :)

import unittest

class TestStringMethods(unittest.TestCase):

    def test_upper(self):
        x=1 #?
        self.assertEqual('foo'.upper(), 'FOO')

    def test_isupper(self):
        self.assertTrue('FOO'.isupper())
        self.assertFalse('Foo'.isupper())

    def test_split(self):
        s = 'hello world'
        self.assertEqual(s.split(), ['hello', 'world'])
        # check that s.split fails when the separator is not a string
        with self.assertRaises(TypeError):
            s.split(2)

if __name__ == '__main__':
    unittest.main(exit=False)

Nothing appears at the #? I don't see any error in the dev console. I'm using python version 3.8.1 on windows.

Note that arepl doesn't work with unittest either. Something funky goes on in unittest code, not sure what.

Also note that you need exit=False untill https://github.com/Duroktar/Wolf/issues/56 is fixed because unittest raises SystemExit. Once https://github.com/Duroktar/Wolf/issues/56 is fixed then you get rid of exit=False