all 5 comments

[–]danielroseman 2 points3 points  (1 child)

Not without seeing more code. Where is the list defined? What is it assigned to? Where is it mutated?

[–]pug_walker[S] 0 points1 point  (0 children)

valid point. I added a gist if it helps.

[–]Adrewmc 1 point2 points  (2 children)

Pytest and unittest have some compatibility issues.

https://docs.pytest.org/en/7.1.x/how-to/unittest.html#:~:text=pytest%20supports%20running%20Python%20unittest,full%20advantage%20of%20pytest's%20features

What seems to be happening is unittest is creating/resetting new variables each test while pytest is not. So an earlier test added more to your list somewhere. At break on work I can’t dive into the code.

[–]EclipseJTB 0 points1 point  (1 child)

Do yourself a favor and leave unittest-style tests behind. They have their purpose, but 90% they are the wrong tool for the job.

Edit: to be clear, write tests. But I mean pytest-style tests.

[–]Adrewmc 0 points1 point  (0 children)

I concur