Skip to content

Commit

Permalink
tests: use unique, non-interned keys for property refcount tests
Browse files Browse the repository at this point in the history
There is an intermittent build failure and I suspect it's because the keys are too generic and are interned, and thus may have their refcount incremented or decremented by some other (background?) process.
  • Loading branch information
rdb committed Jan 22, 2020
1 parent b272af8 commit 508444d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/interrogate/test_property.py
Expand Up @@ -149,7 +149,7 @@ def test_seq_property_getitem():
prop[i]

# Make sure it preserves refcount of invalid indices
i = "nonsense"
i = "nonsense195641"
with constant_refcount(i):
try:
prop[i]
Expand Down Expand Up @@ -250,7 +250,7 @@ def test_seq_property_index():
except ValueError:
pass

nonsense = "nonsense"
nonsense = "nonsense854371"
with constant_refcount(nonsense):
try:
prop.index(nonsense)
Expand All @@ -271,7 +271,7 @@ def test_seq_property_count():
with constant_refcount(item_b):
prop.count(item_b)

nonsense = "nonsense"
nonsense = "nonsense219449"
with constant_refcount(nonsense):
prop.count(nonsense)

Expand Down Expand Up @@ -447,8 +447,8 @@ def test_map_property_empty():


def test_map_property_getitem():
key = 'key'
value = 'value'
key = 'key162732'
value = 'value162732'
prop = map_property(**{key: value})

with constant_refcount(key):
Expand All @@ -462,8 +462,8 @@ def test_map_property_getitem():


def test_map_property_setitem():
key = 'key'
value = 'value'
key = 'key559075'
value = 'value559075'
prop = map_property()

# Setting new key
Expand All @@ -490,8 +490,8 @@ def test_map_property_setitem():


def test_map_property_delitem():
key = 'key'
value = 'value'
key = 'key731691'
value = 'value731691'
prop = map_property(**{key: value})

with constant_refcount(key):
Expand Down Expand Up @@ -519,11 +519,11 @@ def test_map_property_contains():


def test_map_property_get():
key = 'key'
value = 'value'
key = 'key861801'
value = 'value861801'
prop = map_property(**{key: value})

default = 'default'
default = 'default861801'
with constant_refcount(key):
with constant_refcount(default):
assert prop.get(key) == value
Expand Down

0 comments on commit 508444d

Please sign in to comment.