alexmojaki / executing

Get information about what a Python frame is currently doing, particularly the AST node being executed
MIT License
326 stars 32 forks source link

Add many_calls tests to EXECUTING_SLOW_TESTS #78

Closed matoro closed 10 months ago

matoro commented 10 months ago

Still fails on slow CPU.

=================================================== FAILURES ====================================================
_________________________________ TestStuff.test_many_source_for_filename_calls _________________________________

self = <tests.test_main.TestStuff testMethod=test_many_source_for_filename_calls>

    def test_many_source_for_filename_calls(self):
        source = None
        start = time.time()
        for i in range(5000):
            new_source = Source.for_filename(__file__)
            if source is None:
                source = new_source
                self.assertGreater(len(source.lines), 700)
                self.assertGreater(len(source.text), 7000)
            else:
                self.assertIs(source, new_source)
>       self.assertLess(time.time() - start, 1)
E       AssertionError: 1.5195212364196777 not less than 1

i          = 4999
new_source = <executing.executing.Source object at 0x200028dc390>
self       = <tests.test_main.TestStuff testMethod=test_many_source_for_filename_calls>
source     = <executing.executing.Source object at 0x200028dc390>
start      = 1699163050.1516447

tests/test_main.py:304: AssertionError
alexmojaki commented 10 months ago

I think it'd be better to skip this test unless EXECUTING_SLOW_TESTS is on.

matoro commented 10 months ago

I think it'd be better to skip this test unless EXECUTING_SLOW_TESTS is on.

Switched to this and retitled PR.

alexmojaki commented 10 months ago

great, thanks!