Skip to content

Removing state pollution in init_ExpStock.__next__()#18

Open
sturmianseq wants to merge 1 commit intochie8842:masterfrom
sturmianseq:fix
Open

Removing state pollution in init_ExpStock.__next__()#18
sturmianseq wants to merge 1 commit intochie8842:masterfrom
sturmianseq:fix

Conversation

@sturmianseq
Copy link
Copy Markdown

This PR aims to improve test reliability of test test_append_param by removing state pollution in init_ExpStock.__next__() by making a deep copy.

The test can fail in this way by running pip3 install pytest-repeat; python3 -m pytest --count=2 expstock/test_expstock.py::test_append_param:

    def test_append_param(init_ExpStock):
        e = init_ExpStock.__next__()
        test_param1 = 12345
        test_param2 = 'test_param'
        e.append_param(test_param1=test_param1, test_param2=test_param2)
        e.params.sort()
>       assert e.params == [('test_param1', 12345), ('test_param2', 'test_param')]
E       AssertionError: assert [('test_param1', 12345),\n ('test_param1', 12345),\n ('test_param2', 'test_param'),\n ('test_param2', 'test_param')] == [('test_param1', 12345), ('test_param2', 'test_param')]

It may be better to clean state pollutions so that some other tests won't fail in the future due to the shared state pollution.

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

Successfully merging this pull request may close these issues.

1 participant