I'm experiencing an high memory usage if the tests to run are called by test case name instead of test file name.
To explain my issue I will use the following trivial test, called test_try.py:
class TestSuite:
def test_case_1(self):
assert True
def test_case_2(self):
assert True
def test_case_3(self):
assert True
If I want to run all the tests, I can type:
$ pytest -v test_try.py
======================== test session starts ========================
collected 3 items
test_try.py::TestSuite::test_case_1 PASSED
test_try.py::TestSuite::test_case_2 PASSED
test_try.py::TestSuite::test_case_3 PASSED
====================== 3 passed in 0.01 seconds ====================
But in my workflow may be useful call the tests by test case name, so:
$ pytest -v test_try.py::TestSuite::test_case_1 test_try.py::TestSuite::test_case_2 test_try.py::TestSuite::test_case_3
======================== test session starts ========================
collected 12 items
NuSMV/test/bug_026/test_try.py::TestSuite::test_case_1 PASSED
NuSMV/test/bug_026/test_try.py::TestSuite::test_case_2 PASSED
NuSMV/test/bug_026/test_try.py::TestSuite::test_case_3 PASSED
====================== 3 passed in 0.01 seconds ====================
In the first case there are 3 collected items, while in the second case the collected items are 12.
I guess that for every test case there are 4 test collected(3 for all the test case in the file and one for the real test case to run).
If this approach is applied on a larger scale (for instance with many test files that contains many test), I observed a huge increase of memory usage.
I was wandering if there is an easy way to collect only the single test case in order to lower the number of test collected and so the memory usage?
Thanks
I'm experiencing an high memory usage if the tests to run are called by test case name instead of test file name.
To explain my issue I will use the following trivial test, called
test_try.py:If I want to run all the tests, I can type:
But in my workflow may be useful call the tests by test case name, so:
In the first case there are 3 collected items, while in the second case the collected items are 12.
I guess that for every test case there are 4 test collected(3 for all the test case in the file and one for the real test case to run).
If this approach is applied on a larger scale (for instance with many test files that contains many test), I observed a huge increase of memory usage.
I was wandering if there is an easy way to collect only the single test case in order to lower the number of test collected and so the memory usage?
Thanks