Skip to content

Commit

Permalink
fix: Remove server startup from python tests (#768)
Browse files Browse the repository at this point in the history
Fixes #759 

Startup is not needed, only an instance, so removed the startup.
  • Loading branch information
jnumainville authored Aug 29, 2024
1 parent bf38c07 commit c6c2dd2
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 24 deletions.
4 changes: 2 additions & 2 deletions plugins/plotly-express/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@

from deephaven_server import Server

s = Server(port=10075)
s.start()
# need a server instance to pull types from the autodocs
Server(port=10075)
10 changes: 10 additions & 0 deletions plugins/plotly-express/test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from deephaven_server.server import Server

# Create a Server instance to initialize the JVM
# Otherwise we get errors whenever we try to import anything or run tests
# We don't even need to start the server, just create an instance.
# https://github.com/deephaven/deephaven-core/blob/b5cae98c2f11b032cdd1b9c248dc5b4a0f95314a/py/embedded-server/deephaven_server/server.py#L152
# Whenever you import anything from the deephaven namespace, it will check if the JVM is ready:
# https://github.com/deephaven/deephaven-core/blob/b5cae98c2f11b032cdd1b9c248dc5b4a0f95314a/py/server/deephaven/__init__.py#L15
if Server.instance is None:
Server(port=10000, jvm_args=["-Xmx4g"])
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ def remap_types(
class BaseTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
try:
cls.s = Server(port=10000, jvm_args=["-Xmx4g"])
cls.s.start()
except Exception as e:
# server is already running
pass

# these mocks need to be setup after the deephaven server is
# initialized because they access the deephaven namespace
cls.setup_exporter_mock()

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@

from deephaven_server import Server

s = Server(port=10075)
s.start()
# need a server instance to pull types from the autodocs
Server(port=10075)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from deephaven_server.server import Server

# Create a Server instance to initialize the JVM
# Otherwise we get errors whenever we try to import anything or run tests
# We don't even need to start the server, just create an instance.
# https://github.com/deephaven/deephaven-core/blob/b5cae98c2f11b032cdd1b9c248dc5b4a0f95314a/py/embedded-server/deephaven_server/server.py#L152
# Whenever you import anything from the deephaven namespace, it will check if the JVM is ready:
# https://github.com/deephaven/deephaven-core/blob/b5cae98c2f11b032cdd1b9c248dc5b4a0f95314a/py/server/deephaven/__init__.py#L15
if Server.instance is None:
Server(port=11000, jvm_args=["-Xmx4g"])
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@
class BaseTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
try:
# Use port 11000 so it doesn't conflict with another server
cls.s = Server(port=11000, jvm_args=["-Xmx4g"])
cls.s.start()
except Exception as e:
# server is already running
pass

# these mocks need to be setup after the deephaven server is
# initialized because they access the deephaven namespace
cls.setup_exporter_mock()

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Test(BaseTestCase):
def test(self):
# since the tests use the embedded server, the import must happen after the tests start
from deephaven import Table
from deephaven.table import Table

pass

Expand Down

0 comments on commit c6c2dd2

Please sign in to comment.