limit_memory for parametrized tests
Handle parametrized tests requiring differing memory limits. Currently, these tests need to be duplicated but we could use a fixture to apply dynamic memory limit or allow limit memory to be a list of limits.
@pablogsal ideas?
@pytest.mark.parametrize("count", [1, 1000])
@pytest.mark.limit_memory("1 MB") # limit differs per parameter
def test_a(count):
assert 'a' * count
We may be able to expose a context manager somehow and then pass the count as a value in there.
The problem with the context manager would be that now we move the memory consumption from start/end to test to someplace within the test 🤔 and also open the door for running the memory measurement count multiple times within a test. Not sure how would that integrate with the memory report at the end of the test suite. So doing a context manager would require solving some potentially complicated API questions 🤔
So doing a context manager would require solving some potentially complicated API questions 🤔
Well, is not that this problem already doesn't require solving complicated API questions 😅