Skip to content

Commit d65ebc6

Browse files
authored
test: Added tox test (#1266)
Added tox test
1 parent 2307be6 commit d65ebc6

File tree

6 files changed

+71
-0
lines changed

6 files changed

+71
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from deephaven_server.server import Server
2+
3+
# Create a Server instance to initialize the JVM
4+
# Otherwise we get errors whenever we try to import anything or run tests
5+
# We don't even need to start the server, just create an instance.
6+
# https://github.com/deephaven/deephaven-core/blob/b5cae98c2f11b032cdd1b9c248dc5b4a0f95314a/py/embedded-server/deephaven_server/server.py#L152
7+
# Whenever you import anything from the deephaven namespace, it will check if the JVM is ready:
8+
# https://github.com/deephaven/deephaven-core/blob/b5cae98c2f11b032cdd1b9c248dc5b4a0f95314a/py/server/deephaven/__init__.py#L15
9+
if Server.instance is None:
10+
Server(port=11000, jvm_args=["-Xmx4g"])

plugins/python-remote-file-source/test/deephaven/__init__.py

Whitespace-only changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import unittest
2+
from unittest.mock import patch
3+
4+
from deephaven_server import Server
5+
6+
7+
class BaseTestCase(unittest.TestCase):
8+
@classmethod
9+
def setUpClass(cls):
10+
cls.setup_exporter_mock()
11+
12+
@classmethod
13+
@patch("deephaven.plugin.object_type.Exporter")
14+
@patch("deephaven.plugin.object_type.Reference")
15+
def setup_exporter_mock(cls, MockExporter, MockReference):
16+
cls.exporter = MockExporter()
17+
cls.reference = MockReference()
18+
19+
cls.reference.index = 0
20+
cls.exporter.reference.return_value = MockReference()
21+
22+
23+
if __name__ == "__main__":
24+
unittest.main()

plugins/python-remote-file-source/test/deephaven/python-remote-file-source/__init__.py

Whitespace-only changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import unittest
2+
from .BaseTest import BaseTestCase
3+
4+
from src.deephaven.python_remote_file_source import PluginObject
5+
6+
7+
class Test(BaseTestCase):
8+
def test(self):
9+
result = PluginObject()
10+
11+
12+
if __name__ == "__main__":
13+
unittest.main()
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[tox]
2+
isolated_build = True
3+
4+
[testenv]
5+
deps =
6+
deephaven-server
7+
commands =
8+
python -m unittest {posargs}
9+
basepython = python3.9
10+
11+
[testenv:py3.9]
12+
basepython = python3.9
13+
14+
[testenv:py3.10]
15+
basepython = python3.10
16+
17+
[testenv:py3.11]
18+
basepython = python3.11
19+
20+
[testenv:py3.12]
21+
basepython = python3.12
22+
23+
[testenv:py3.13]
24+
basepython = python3.13

0 commit comments

Comments
 (0)