def mt(): # if not miney.is_miney_available(): # assert miney.run_miney_game(), "Minetest with mineysocket isn't running." mt = miney.Minetest() assert len(mt.player) >= 1 return miney.Minetest()
def test_connection(mt: miney.Minetest): """ Test connection with some missconfigurations. :param mt: fixture :return: None """ # wrong server name with pytest.raises(socket.gaierror) as e: mt_fail = miney.Minetest("someunresolveableserver", "someuser", "somepass") # wrong port / apisocket unreachable or not running with pytest.raises((socket.timeout, ConnectionResetError)) as e: mt_fail = miney.Minetest(port=12345)
for z in range(-R - r, R + r): if ring_dist_sq + z**2 <= r**2: positions.append({ "x": (mcx + x), "y": (mcz + y), "z": (mcy + z) }) print("Spawning", len(positions), "nodes of", mcblock) mt.node.set(position=positions, node_type=mcblock) if miney.is_miney_available(): if not miney.is_miney_available(): raise miney.MinetestRunError( "Please start Minetest with the miney game") mt = miney.Minetest() playerPos = mt.player[0].position draw_donut(mt, playerPos["x"], playerPos["y"] + 1, playerPos["z"], 60, 10, mt.node.type.default.glass) mt.chat.send_to_all(mt.node.type.default.glass + " donut done") print(mt.node.type.default.glass + " donut done") draw_donut(mt, playerPos["x"], playerPos["y"] + 1, playerPos["z"], 60, 8, mt.node.type.default.lava_source) mt.chat.send_to_all(mt.node.type.default.lava_source + " donut done") print(mt.node.type.default.lava_source + " donut done") else: raise Exception( "Please run miney before running this example. \n"