Skip to content

Commit 6667cbf

Browse files
authored
Enable tests in CI (#14)
1 parent 28035f1 commit 6667cbf

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

.github/workflows/ubuntu_basic.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Install bazel
1919
run: |
2020
apt-get update
21-
apt-get install -yq wget gcc g++ python3.8 zlib1g-dev zip libuv1.dev
21+
apt-get install -yq wget gcc g++ python3.7 zlib1g-dev zip libuv1.dev
2222
apt-get install -yq pip
2323
wget "https://github.com/bazelbuild/bazel/releases/download/5.1.0/bazel_5.1.0-linux-x86_64.deb" -O bazel_5.1.0-linux-x86_64.deb
2424
dpkg -i bazel_5.1.0-linux-x86_64.deb
@@ -32,12 +32,8 @@ jobs:
3232
pip install pytest torch
3333
pip install ray==1.11.0
3434
35-
- name: Build Pygloo
35+
- name: Build and test
3636
run: |
3737
. py3/bin/activate
38-
python setup.py install
39-
40-
- name: Test
41-
run: |
42-
. py3/bin/activate
43-
pytest -v ./tests
38+
python3 setup.py install
39+
cd tests && python3 -m pytest *

tests/test_custom_store.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import time
66
import shutil
77
import torch
8+
import pytest
89

910
import ray.experimental.internal_kv as internal_kv
1011
from ray._private.gcs_utils import GcsClient
@@ -55,7 +56,7 @@ def __init__(self):
5556
custom_store = pygloo.rendezvous.CustomStore(real_store)
5657
self._context.connectFullMesh(custom_store, dev)
5758

58-
def test_send(self):
59+
def do_send(self):
5960
sendbuf = np.array([[1,2,3],[1,2,3]], dtype=np.float32)
6061
sendptr = sendbuf.ctypes.data
6162
pygloo.send(self._context, sendptr, sendbuf.size, pygloo.glooDataType_t.glooFloat32, 1)
@@ -74,7 +75,7 @@ def __init__(self):
7475
custom_store = pygloo.rendezvous.CustomStore(real_store)
7576
self._context.connectFullMesh(custom_store, dev)
7677

77-
def test_recv(self):
78+
def do_recv(self):
7879
recvbuf = np.zeros((2, 3), dtype=np.float32)
7980
recvptr = recvbuf.ctypes.data
8081

@@ -86,19 +87,21 @@ def test_recv(self):
8687
return recvbuf
8788

8889

89-
def main():
90+
def test_basic():
9091
ray.init(num_cpus=6)
9192

9293
sender = Sender.remote()
9394
recver = Recver.remote()
94-
fn1 = sender.test_send.remote()
95-
fn2 = recver.test_recv.remote()
95+
fn1 = sender.do_send.remote()
96+
fn2 = recver.do_recv.remote()
9697

9798
a, b = ray.get([fn1, fn2])
98-
print(a)
99-
print(b)
100-
print("END")
99+
assert a
100+
expected = [[1, 2, 3], [1, 2, 3]]
101+
assert len(b) == 2
102+
assert len(b[0]) == 3
103+
assert len(b[1]) == 3
101104

102105

103106
if __name__ == "__main__":
104-
main()
107+
sys.exit(pytest.main(["-v", __file__]))

0 commit comments

Comments
 (0)