Skip to content

Commit

Permalink
FIX: Testing on Pypy (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
caspervdw committed Jul 5, 2021
1 parent 97e455d commit e906ce9
Showing 1 changed file with 9 additions and 2 deletions.
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

0 comments on commit e906ce9

Please sign in to comment.