Skip to content

Commit

Permalink
Merge pull request #10 from reallistic/speed_up_tests
Browse files Browse the repository at this point in the history
speed up tests
  • Loading branch information
reallistic authored Jun 11, 2020
2 parents b2a79ac + c36af74 commit 11a0570
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/test_collection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import NamedTuple
from unittest import mock

from pyloot import InMemoryBackend
from pyloot import PyLoot
Expand All @@ -16,7 +17,11 @@ def test_collection():
f = Foo(1, 2)
MEM_LK_SIM.append(f)
pyloot = PyLoot()
pyloot.collect_objects()
with mock.patch(
"pyloot.collector.gc.get_objects", return_value=[f]
) as mocked_get_objects:
pyloot.collect_objects()
mocked_get_objects.assert_called_once_with()
backend: InMemoryBackend = pyloot._backend
assert isinstance(backend, InMemoryBackend)
objs = backend.fetch()
Expand Down
4 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ commands =
coverage report -m
coverage html -d .tox/test-reports/{envname}/coverage-html
coverage xml -o .tox/test-reports/{envname}/coverage.xml


[pytest]
junit_family = xunit2

0 comments on commit 11a0570

Please sign in to comment.