Hey all-
I've been exploring some of our tests that use a lot of memory, and whose
memory use seems to grow over the course of a test run. In my preliminary
investiagtion it seems like some of the memory use can be attributed to
fixtures which create large objects. I'm using py.test 3.1.3 in python
2.7.13.

We have a bunch of conftests and a local pytest plugin that changes some
behaviors, so I want to check in about intended behavior before I go
further.

If I have a fixture like the following, should I expect the object returned
by the fixture to be garbage collected after the tests that use it complete?
Or after all the tests in the module complete? Or after the seesion
completes?

    @pytest.fixture(scope='module')
    def big_item():
        return [0] *1000000

Is this a reasonable way to use a fixture, or is there a better way to
reuse a large and
expensive-to-create item across tests?

Thanks,
Dan N
_______________________________________________
pytest-dev mailing list
pytest-dev@python.org
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to