HBehrens / puncover

Analyses C/C++ build output for code size, static variables, and stack usage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fix issues with Python 3.5

HBehrens opened this issue · comments

@tyhoff discovered issues with Python 3.5 while working on #35 , this issue describes the work of fixing those.

Played a little with this:

$ python3.5 -m nose
.................F.....................................
======================================================================
FAIL: test_enhance_file_elements (tests.test_collector.TestCollector)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/tyler/dev/junk/puncover/tests/test_collector.py", line 415, in test_enhance_file_elements
    self.assertListEqual([aa, ab, b], crf)
AssertionError: Lists differ: [{'co[18 chars]s': [], 'name': 'a', 'collapsed_name': 'a/a', [6996 chars]'b'}] != [{'co[18 chars]s': [{'collapsed_sub_folders': [], 'name': 'a'[6996 chars]/b'}]

First differing element 0:
{'col[17 chars]s': [], 'name': 'a', 'collapsed_name': 'a/a', [2565 chars]a/a'}
{'col[17 chars]s': [{'collapsed_sub_folders': [], 'name': 'a'[1715 chars] 'b'}

Diff is 28182 characters long. Set self.maxDiff to None to see it.

----------------------------------------------------------------------
Ran 55 tests in 0.196s

This only happens for my with a 3.5.10 installation of Python, not a 3.5.5.

The two lists contain the same elements, just not in the same order. I assume in future versions, Python did something around sorting that enable these tests to pass.

One thing to consider would be to change assertListEqual to assertCountEqual if the order doesn't matter.

https://docs.python.org/3.2/library/unittest.html#unittest.TestCase.assertCountEqual

But, at the end of the day, most people are deprecating support for 3.5. 🤷

3.6 is long gone:
https://endoflife.date/python

Gonna just remove <3.7 now.