Skip to content

Commit 55747a9

Browse files
committed
addding pytest in the workflow
1 parent 4cc2084 commit 55747a9

File tree

3 files changed

+68
-3
lines changed

3 files changed

+68
-3
lines changed

.github/workflows/ci.yml

+17
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ jobs:
4242
- name: Build package
4343
run: |
4444
CXXFLAGS=--coverage CFLAGS=--coverage python scripts/build/install.py
45+
46+
- name: Install pytest
47+
run: |
48+
pip install pytest
49+
4550
# coverage tests
4651
- name: Run tests
4752
run: |
@@ -104,6 +109,10 @@ jobs:
104109
run: |
105110
python scripts/build/install.py
106111
112+
- name: Install pytest
113+
run: |
114+
pip install pytest
115+
107116
- name: Run tests
108117
run: |
109118
python -c "import pydatastructs; pydatastructs.test(only_benchmarks=True)"
@@ -145,6 +154,10 @@ jobs:
145154
run: |
146155
python scripts/build/install.py
147156
157+
- name: Install pytest
158+
run: |
159+
pip install pytest
160+
148161
- name: Run tests
149162
run: |
150163
python -c "import pydatastructs; pydatastructs.test()"
@@ -193,6 +206,10 @@ jobs:
193206
run: |
194207
python scripts/build/install.py
195208
209+
- name: Install pytest
210+
run: |
211+
pip install pytest
212+
196213
- name: Run tests
197214
run: |
198215
python -c "import pydatastructs; pydatastructs.test()"

pydatastructs/graphs/tests/test_algorithms.py

+50-3
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ def _test_shortest_paths_positive_edges(ds, algorithm):
278278
GraphNode('D')]
279279

280280
graph = Graph(*vertices)
281+
graph.add_vertex('S')
282+
graph.add_vertex('C')
283+
graph.add_vertex('SLC')
284+
graph.add_vertex('SF')
285+
graph.add_vertex('D')
281286
graph.add_edge('S', 'SLC', 2)
282287
graph.add_edge('C', 'S', 4)
283288
graph.add_edge('C', 'D', 2)
@@ -304,6 +309,11 @@ def _test_shortest_paths_negative_edges(ds, algorithm):
304309
GraphNode('d')]
305310

306311
graph = Graph(*vertices)
312+
graph.add_vertex('s')
313+
graph.add_vertex('a')
314+
graph.add_vertex('b')
315+
graph.add_vertex('c')
316+
graph.add_vertex('d')
307317
graph.add_edge('s', 'a', 3)
308318
graph.add_edge('s', 'b', 2)
309319
graph.add_edge('a', 'c', 1)
@@ -333,6 +343,10 @@ def _test_shortest_paths_negative_edges(ds, algorithm):
333343
GraphNode('3'), GraphNode('4')]
334344

335345
graph = Graph(*vertices)
346+
graph.add_vertex('1')
347+
graph.add_vertex('2')
348+
graph.add_vertex('3')
349+
graph.add_vertex('4')
336350
graph.add_edge('1', '3', -2)
337351
graph.add_edge('2', '1', 4)
338352
graph.add_edge('2', '3', 3)
@@ -362,6 +376,14 @@ def _test_topological_sort(func, ds, algorithm, threads=None):
362376
GraphNode('11'), GraphNode('9')]
363377

364378
graph = Graph(*vertices)
379+
graph.add_vertex('2')
380+
graph.add_vertex('3')
381+
graph.add_vertex('5')
382+
graph.add_vertex('7')
383+
graph.add_vertex('8')
384+
graph.add_vertex('10')
385+
graph.add_vertex('11')
386+
graph.add_vertex('9')
365387
graph.add_edge('5', '11')
366388
graph.add_edge('7', '11')
367389
graph.add_edge('7', '8')
@@ -395,7 +417,11 @@ def _test_max_flow(ds, algorithm):
395417
e = GraphNode('e')
396418

397419
G = Graph(a, b, c, d, e)
398-
420+
G.add_vertex('a')
421+
G.add_vertex('b')
422+
G.add_vertex('c')
423+
G.add_vertex('d')
424+
G.add_vertex('e')
399425
G.add_edge('a', 'b', 3)
400426
G.add_edge('a', 'c', 4)
401427
G.add_edge('b', 'c', 2)
@@ -414,7 +440,12 @@ def _test_max_flow(ds, algorithm):
414440
f = GraphNode('f')
415441

416442
G2 = Graph(a, b, c, d, e, f)
417-
443+
G2.add_vertex('a')
444+
G2.add_vertex('b')
445+
G2.add_vertex('c')
446+
G2.add_vertex('d')
447+
G2.add_vertex('e')
448+
G2.add_vertex('f')
418449
G2.add_edge('a', 'b', 16)
419450
G2.add_edge('a', 'c', 13)
420451
G2.add_edge('b', 'c', 10)
@@ -435,7 +466,10 @@ def _test_max_flow(ds, algorithm):
435466
d = GraphNode('d')
436467

437468
G3 = Graph(a, b, c, d)
438-
469+
G3.add_vertex('a')
470+
G3.add_vertex('b')
471+
G3.add_vertex('c')
472+
G3.add_vertex('d')
439473
G3.add_edge('a', 'b', 3)
440474
G3.add_edge('a', 'c', 2)
441475
G3.add_edge('b', 'c', 2)
@@ -468,6 +502,11 @@ def _test_find_bridges(ds):
468502
v4 = GraphNode(4)
469503

470504
G1 = Graph(v0, v1, v2, v3, v4, implementation=impl)
505+
G1.add_vertex('0')
506+
G1.add_vertex('1')
507+
G1.add_vertex('2')
508+
G1.add_vertex('3')
509+
G1.add_vertex('4')
471510
G1.add_edge(v0.name, v1.name)
472511
G1.add_edge(v1.name, v2.name)
473512
G1.add_edge(v2.name, v3.name)
@@ -482,6 +521,9 @@ def _test_find_bridges(ds):
482521
u2 = GraphNode(2)
483522

484523
G2 = Graph(u0, u1, u2, implementation=impl)
524+
G2.add_vertex('0')
525+
G2.add_vertex('1')
526+
G2.add_vertex('2')
485527
G2.add_edge(u0.name, u1.name)
486528
G2.add_edge(u1.name, u2.name)
487529
G2.add_edge(u2.name, u0.name)
@@ -496,6 +538,11 @@ def _test_find_bridges(ds):
496538
w4 = GraphNode(4)
497539

498540
G3 = Graph(w0, w1, w2, w3, w4, implementation=impl)
541+
G3.add_vertex('0')
542+
G3.add_vertex('1')
543+
G3.add_vertex('2')
544+
G3.add_vertex('3')
545+
G3.add_vertex('4')
499546
G3.add_edge(w0.name, w1.name)
500547
G3.add_edge(w1.name, w2.name)
501548
G3.add_edge(w3.name, w4.name)

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
codecov
22
pytest-cov
3+
pytest

0 commit comments

Comments
 (0)