Code Duplication    Length = 23-23 lines in 2 locations

tests/conftest.py 1 location

@@ 151-173 (lines=23) @@
148
    else:
149
        return remote_conn
150
151
@pytest.fixture(autouse=True)
152
def run_around_tests(remote_connection, event_loop):
153
    g = Graph().traversal().withRemote(remote_connection)
154
155
    async def create_graph():
156
        await g.V().drop().iterate()
157
        software1 = await g.addV("software").property("name", "lop").property("lang", "java").property(T.id, 3).next()
158
        software2 = await g.addV("software").property("name", "ripple").property("lang", "java").property(T.id, 5).next()
159
        person1 = await g.addV("person").property("name", "marko").property("age", "29").property(T.id, 1).next()
160
        person2 = await g.addV("person").property("name", "vadas").property("age", "27").property(T.id, 2).next()
161
        person3 = await g.addV("person").property("name", "josh").property("age", "32").property(T.id, 4).next()
162
        person4 = await g.addV("person").property("name", "peter").property("age", "35").property(T.id, 6).next()
163
164
        knows1 = await g.addE("knows").from_(person1).to(person2).property("weight", 0.5).property(T.id, 7).next()
165
        knows2 = await g.addE("knows").from_(person1).to(person3).property("weight", 1,0).property(T.id, 8).next()
166
        created1 = await g.addE("created").from_(person1).to(software1).property("weight", 0.4).property(T.id, 9).next()
167
        created2 = await g.addE("created").from_(person3).to(software2).property("weight", 1.0).property(T.id, 10).next()
168
        created3 = await g.addE("created").from_(person3).to(software1).property("weight", 1.0).property(T.id, 11).next()
169
        created4 = await g.addE("created").from_(person4).to(software1).property("weight", 0.2).property(T.id, 12).next()
170
171
    event_loop.run_until_complete(create_graph())
172
173
    yield
174

tests/test_gremlin_python/conftest.py 1 location

@@ 49-71 (lines=23) @@
46
    else:
47
        return remote_conn
48
49
@pytest.fixture(autouse=True)
50
def run_around_tests(remote_connection, event_loop):
51
    g = Graph().traversal().withRemote(remote_connection)
52
53
    async def create_graph():
54
        await g.V().drop().iterate()
55
        software1 = await g.addV("software").property("name", "lop").property("lang", "java").property(T.id, 3).next()
56
        software2 = await g.addV("software").property("name", "ripple").property("lang", "java").property(T.id, 5).next()
57
        person1 = await g.addV("person").property("name", "marko").property("age", "29").property(T.id, 1).next()
58
        person2 = await g.addV("person").property("name", "vadas").property("age", "27").property(T.id, 2).next()
59
        person3 = await g.addV("person").property("name", "josh").property("age", "32").property(T.id, 4).next()
60
        person4 = await g.addV("person").property("name", "peter").property("age", "35").property(T.id, 6).next()
61
62
        knows1 = await g.addE("knows").from_(person1).to(person2).property("weight", 0.5).property(T.id, 7).next()
63
        knows2 = await g.addE("knows").from_(person1).to(person3).property("weight", 1,0).property(T.id, 8).next()
64
        created1 = await g.addE("created").from_(person1).to(software1).property("weight", 0.4).property(T.id, 9).next()
65
        created2 = await g.addE("created").from_(person3).to(software2).property("weight", 1.0).property(T.id, 10).next()
66
        created3 = await g.addE("created").from_(person3).to(software1).property("weight", 1.0).property(T.id, 11).next()
67
        created4 = await g.addE("created").from_(person4).to(software1).property("weight", 0.2).property(T.id, 12).next()
68
69
    event_loop.run_until_complete(create_graph())
70
71
    yield
72