MCPcopy Create free account
hub / github.com/alibaba/GraphScope / test_border_cases

Function test_border_cases

python/graphscope/tests/unittest/test_session.py:74–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72
73@pytest.mark.skipif("FULL_TEST_SUITE" not in os.environ, reason="Run in nightly CI")
74def test_border_cases():
75 s1 = graphscope.session(cluster_type="hosts")
76 s2 = graphscope.session(cluster_type="hosts")
77 s3 = graphscope.session(cluster_type="hosts")
78
79 s1.as_default()
80 assert graphscope.get_default_session() == s1
81
82 g3 = load_p2p_network(s3)
83 pg3 = g3.project(vertices={"host": ["id"]}, edges={"connect": ["dist"]})
84
85 with pytest.raises(
86 ValueError,
87 match="A default session is already active. You must explicitly call Session.close().",
88 ):
89 s2.as_default()
90
91 s1.close()
92
93 s2.as_default()
94 assert graphscope.get_default_session() == s2
95 s2.close()
96
97 s3.as_default()
98 assert graphscope.get_default_session() == s3
99 sssp = graphscope.sssp(pg3, src=4) # ok, g3 belong to s3
100 s3.close()
101
102
103def test_with():

Callers

nothing calls this directly

Calls 5

load_p2p_networkFunction · 0.90
as_defaultMethod · 0.80
closeMethod · 0.65
sessionMethod · 0.45
projectMethod · 0.45

Tested by

no test coverage detected