From bd5a60904d9fafc353fd6ee35c75007f84f441c0 Mon Sep 17 00:00:00 2001 From: Andrew Baranec Date: Mon, 6 Jan 2025 23:39:57 -0500 Subject: [PATCH] Fix tests --- py/client/build.gradle | 2 +- py/client/tests/test_session.py | 35 ++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/py/client/build.gradle b/py/client/build.gradle index c295ca002de..e2c45895ee4 100644 --- a/py/client/build.gradle +++ b/py/client/build.gradle @@ -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}" diff --git a/py/client/tests/test_session.py b/py/client/tests/test_session.py index 8e52caa3d36..37457005aa6 100644 --- a/py/client/tests/test_session.py +++ b/py/client/tests/test_session.py @@ -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()