Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abaranec committed Jan 7, 2025
1 parent 45145d8 commit bd5a609
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion py/client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ tasks.register('updateProtobuf', Sync) {
String randomSuffix = UUID.randomUUID().toString();
deephavenDocker {
envVars.set([
'START_OPTS':'-Xmx512m -DAuthHandlers=io.deephaven.auth.AnonymousAuthenticationHandler'
'START_OPTS':'-Xmx512m -DAuthHandlers=io.deephaven.auth.AnonymousAuthenticationHandler -DSystemicObjectTracker.enabled=true'
])
containerName.set "pydeephaven-test-container-${randomSuffix}"
networkName.set "pydeephaven-network-${randomSuffix}"
Expand Down
35 changes: 19 additions & 16 deletions py/client/tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,33 +410,36 @@ def _interact_with_server(ti):
t.join()

def test_systemic_scripts(self):
fields = [pa.field(f"S", pa.bool_())]
schema = pa.schema(fields)

with Session() as session:
console_script = ("""
# Run the setup script.
session.run_script("""
from deephaven import time_table
import jpy
j_sot = jpy.get_type("io.deephaven.engine.util.systemicmarking.SystemicObjectTracker")
print("SYSTEMIC: " + str(j_sot.isSystemicThread()))
print("SYSTEMIC_ENABLED: " + str(j_sot.isSystemicObjectMarkingEnabled()))
""")
table_script = """
t1 = time_table("PT1S").update("A=ii")
t2 = empty_table(1).update("S = (boolean)j_sot.isSystemic(t1.j_table)")
""")
session.run_script(console_script, False)
"""
# Make sure defaults apply (expected false)
session.run_script(table_script)
t = session.fetch_table(ticket=ScopeTicket.scope_ticket("t2"))
pa_data = [
pa.array([True])
]
fields = [pa.field(f"S", pa.bool_())]
schema = pa.schema(fields)
pa_table = pa.table([ pa.array([False]) ], schema=schema)
self.assertTrue(pa_table.equals(t.to_arrow()))

pa_table = pa.table(pa_data, schema=schema)
session.run_script(table_script, True)
t = session.fetch_table(ticket=ScopeTicket.scope_ticket("t2"))
pa_table = pa.table([ pa.array([True]) ], schema=schema)
self.assertTrue(pa_table.equals(t.to_arrow()))

print(pa_table.to_string(preview_cols=1))
print(t.to_arrow().to_string(preview_cols=1))
session.run_script(table_script, False)
t = session.fetch_table(ticket=ScopeTicket.scope_ticket("t2"))
pa_table = pa.table([ pa.array([False]) ], schema=schema)
self.assertTrue(pa_table.equals(t.to_arrow()))
self.assertFalse(True)

if __name__ == '__main__':
unittest.main()

0 comments on commit bd5a609

Please sign in to comment.