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

Tests fail with python3.13b2 #312

Open
keszybz opened this issue Jun 10, 2024 · 0 comments
Open

Tests fail with python3.13b2 #312

keszybz opened this issue Jun 10, 2024 · 0 comments

Comments

@keszybz
Copy link
Contributor

keszybz commented Jun 10, 2024

It seems that there are some small differences in output:

________________________________________ test_class_methods _________________________________________

    def test_class_methods():
        profiler = Profiler()
    
        with fake_time():
            profiler.start()
    
            obj = ClassWithMethods()
            obj.long_method()
            obj.long_class_method()
            obj.long_static_method()
            partial(obj.long_method)()
    
            profiler.stop()
    
        text_output = profiler.output_text()
        print(text_output)
    
        # output should be something like:
        # 1.000 test_class_methods  test/test_profiler.py:124
        # |- 0.500 ClassWithMethods.long_method  test/test_profiler.py:29
        # |  `- 0.500 FakeClock.sleep  test/fake_time_util.py:19
        # |- 0.250 ClassWithMethods.long_class_method  test/test_profiler.py:36
        # |  `- 0.250 FakeClock.sleep  test/fake_time_util.py:19
        # `- 0.250 long_static_method  test/test_profiler.py:32
        #    `- 0.250 FakeClock.sleep  test/fake_time_util.py:19
>       assert text_output.count("0.500 ClassWithMethods.long_method") == 1
E       assert 0 == 1
E        +  where 0 = <built-in method count of str object at 0x55aa9dacdc50>('0.500 ClassWithMethods.long_method')
E        +    where <built-in method count of str object at 0x55aa9dacdc50> = "\n  _     ._   __/__   _ _  _  _ _/_   Recorded: 11:46:25  Samples:  4\n /_//_/// /_\\ / //_// / //_'/ //     Duration: 0.001     CPU time: 0.001\n/   _/                      v4.6.2\n\nProgram: /usr/bin/pytest -v test/test_profiler.py::test_class_methods\n\n1.000 test_class_methods  test/test_profiler.py:125\n|- 0.500 long_method  test/test_profiler.py:30\n|  `- 0.500 sleep  test/fake_time_util.py:21\n|- 0.250 long_class_method  test/test_profiler.py:37\n|  `- 0.250 sleep  test/fake_time_util.py:21\n`- 0.250 long_static_method  test/test_profiler.py:33\n   `- 0.250 sleep  test/fake_time_util.py:21\n\n".count

test/test_profiler.py:150: AssertionError
--------------------------------------- Captured stdout call ----------------------------------------

  _     ._   __/__   _ _  _  _ _/_   Recorded: 11:46:25  Samples:  4
 /_//_/// /_\ / //_// / //_'/ //     Duration: 0.001     CPU time: 0.001
/   _/                      v4.6.2

Program: /usr/bin/pytest -v test/test_profiler.py::test_class_methods

1.000 test_class_methods  test/test_profiler.py:125
|- 0.500 long_method  test/test_profiler.py:30
|  `- 0.500 sleep  test/fake_time_util.py:21
|- 0.250 long_class_method  test/test_profiler.py:37
|  `- 0.250 sleep  test/fake_time_util.py:21
`- 0.250 long_static_method  test/test_profiler.py:33
   `- 0.250 sleep  test/fake_time_util.py:21
_____________________ test_frame_info_with_classes[get_frame_info_for_a_method] _____________________

test_function = <bound method AClass.get_frame_info_for_a_method of <test.low_level.test_frame_info.AClass object at 0x7fb11af94c20>>

    @pytest.mark.parametrize('test_function',
                             ['get_frame_info_for_a_method',
                              'get_frame_info_for_a_class_method',
                              'get_frame_info_with_cell_variable'])
    def test_frame_info_with_classes(test_function):
        if 'class' in test_function:
            test_function = getattr(AClass, test_function)
        else:
            instance = AClass()
            test_function = getattr(instance, test_function)
    
        c_frame_info = test_function(stat_profile_c.get_frame_info)
        py_frame_info = test_function(stat_profile_python.get_frame_info)
    
>       assert c_frame_info == py_frame_info
E       AssertionError: assert 'get_frame_in...y\x009\x01l12' == 'get_frame_in...AClass\x01l12'
E         - get_frame_info_for_a_method/builddir/build/BUILD/pyinstrument-4.6.2-build/pyinstrument-4.6.2/test/low_level/test_frame_info.py9cAClassl12
E         ?                                                                                                                                   --------
E         + get_frame_info_for_a_method/builddir/build/BUILD/pyinstrument-4.6.2-build/pyinstrument-4.6.2/test/low_level/test_frame_info.py9l12

test/low_level/test_frame_info.py:77: AssertionError
__________________ test_frame_info_with_classes[get_frame_info_for_a_class_method] __________________

test_function = <bound method AClass.get_frame_info_for_a_class_method of <class 'test.low_level.test_frame_info.AClass'>>

    @pytest.mark.parametrize('test_function',
                             ['get_frame_info_for_a_method',
                              'get_frame_info_for_a_class_method',
                              'get_frame_info_with_cell_variable'])
    def test_frame_info_with_classes(test_function):
        if 'class' in test_function:
            test_function = getattr(AClass, test_function)
        else:
            instance = AClass()
            test_function = getattr(instance, test_function)
    
        c_frame_info = test_function(stat_profile_c.get_frame_info)
        py_frame_info = test_function(stat_profile_python.get_frame_info)
    
>       assert c_frame_info == py_frame_info
E       AssertionError: assert 'get_frame_in...\x0025\x01l29' == 'get_frame_in...AClass\x01l29'
E         - get_frame_info_for_a_class_method/builddir/build/BUILD/pyinstrument-4.6.2-build/pyinstrument-4.6.2/test/low_level/test_frame_info.py25cAClassl29
E         ?                                                                                                                                          --------
E         + get_frame_info_for_a_class_method/builddir/build/BUILD/pyinstrument-4.6.2-build/pyinstrument-4.6.2/test/low_level/test_frame_info.py25l29

test/low_level/test_frame_info.py:77: AssertionError
__________________ test_frame_info_with_classes[get_frame_info_with_cell_variable] __________________

test_function = <bound method AClass.get_frame_info_with_cell_variable of <test.low_level.test_frame_info.AClass object at 0x7fb11afad1d0>>

    @pytest.mark.parametrize('test_function',
                             ['get_frame_info_for_a_method',
                              'get_frame_info_for_a_class_method',
                              'get_frame_info_with_cell_variable'])
    def test_frame_info_with_classes(test_function):
        if 'class' in test_function:
            test_function = getattr(AClass, test_function)
        else:
            instance = AClass()
            test_function = getattr(instance, test_function)
    
        c_frame_info = test_function(stat_profile_c.get_frame_info)
        py_frame_info = test_function(stat_profile_python.get_frame_info)
    
>       assert c_frame_info == py_frame_info
E       AssertionError: assert 'get_frame_in...\x0014\x01l23' == 'get_frame_in...AClass\x01l23'
E         - get_frame_info_with_cell_variable/builddir/build/BUILD/pyinstrument-4.6.2-build/pyinstrument-4.6.2/test/low_level/test_frame_info.py14cAClassl23
E         ?                                                                                                                                          --------
E         + get_frame_info_with_cell_variable/builddir/build/BUILD/pyinstrument-4.6.2-build/pyinstrument-4.6.2/test/low_level/test_frame_info.py14l23

test/low_level/test_frame_info.py:77: AssertionError

This is with python3-3.13.0~b2-3.fc41.x86_64.
Downstream bug report: https://bugzilla.redhat.com/show_bug.cgi?id=2290554.
That also has replication instructions for the environment.

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

1 participant