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

limit_memory for parametrized tests #33

Open
gaborbernat opened this issue May 31, 2022 · 3 comments
Open

limit_memory for parametrized tests #33

gaborbernat opened this issue May 31, 2022 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@gaborbernat
Copy link
Contributor

gaborbernat commented May 31, 2022

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 
@pablogsal
Copy link
Member

We may be able to expose a context manager somehow and then pass the count as a value in there.

@gaborbernat
Copy link
Contributor Author

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 🤔

@pablogsal
Copy link
Member

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 😅

@gaborbernat gaborbernat added enhancement New feature or request help wanted Extra attention is needed labels Aug 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants