Skip to content

Commit

Permalink
Add pytest input parameter to only set the ordering timestamp for one…
Browse files Browse the repository at this point in the history
… variation
  • Loading branch information
kounelisagis committed Mar 28, 2024
1 parent 1550d27 commit e6ab05d
Show file tree
Hide file tree
Showing 6 changed files with 363 additions and 202 deletions.
27 changes: 16 additions & 11 deletions tiledb/tests/test_fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class SOMA919Test(DiskTestCase):
We've distilled @atolopko-czi's gist example using the TileDB-Py API directly.
"""

def run_test(self):
def run_test(self, use_timestamps):
import tempfile

import numpy as np
Expand All @@ -267,13 +267,17 @@ def run_test(self):

root_uri = tempfile.mkdtemp()

# this tiledb.Ctx is how we set the write timestamps for tiledb.Group
group_ctx100 = tiledb.Ctx(
{
"sm.group.timestamp_start": 100,
"sm.group.timestamp_end": 100,
}
)
if use_timestamps:
group_ctx100 = tiledb.Ctx(
{
"sm.group.timestamp_start": 100,
"sm.group.timestamp_end": 100,
}
)
timestamp = 100
else:
group_ctx100 = tiledb.Ctx()
timestamp = None

# create the group and add a dummy subgroup "causes_bug"
tiledb.Group.create(root_uri, ctx=group_ctx100)
Expand All @@ -284,7 +288,7 @@ def run_test(self):
# add an array to the group (in a separate write operation)
with tiledb.Group(root_uri, mode="w", ctx=group_ctx100) as expt:
df_path = os.path.join(root_uri, "df")
tiledb.from_numpy(df_path, np.ones((100, 100)), timestamp=100)
tiledb.from_numpy(df_path, np.ones((100, 100)), timestamp=timestamp)
expt.add(name="df", uri=df_path)

# check our view of the group at current time;
Expand All @@ -301,12 +305,13 @@ def run_test(self):
tiledb.libtiledb.version() < (2, 15, 0),
reason="SOMA919 fix implemented in libtiledb 2.15",
)
def test_soma919(self):
@pytest.mark.parametrize("use_timestamps", [True, False])
def test_soma919(self, use_timestamps):
N = 100
fails = 0
for i in range(N):
try:
self.run_test()
self.run_test(use_timestamps)
except AssertionError:
fails += 1
if fails > 0:
Expand Down
Loading

0 comments on commit e6ab05d

Please sign in to comment.