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

FIX: Testing on Pypy #353

Merged
merged 2 commits into from
Jul 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions pygeos/test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from contextlib import contextmanager

import numpy as np
import pytest

import pygeos

Expand Down Expand Up @@ -52,14 +53,20 @@

@contextmanager
def assert_increases_refcount(obj):
before = sys.getrefcount(obj)
try:
before = sys.getrefcount(obj)
except AttributeError: # happens on Pypy
pytest.skip("sys.getrefcount is not available.")
yield
assert sys.getrefcount(obj) == before + 1


@contextmanager
def assert_decreases_refcount(obj):
before = sys.getrefcount(obj)
try:
before = sys.getrefcount(obj)
except AttributeError: # happens on Pypy
pytest.skip("sys.getrefcount is not available.")
yield
assert sys.getrefcount(obj) == before - 1

Expand Down