Skip to content

Commit

Permalink
Fix data paths in tests (#23)
Browse files Browse the repository at this point in the history
* change parse_graphml argument to object not vector

* use data paths derived from project root in tests
  • Loading branch information
m-fila authored Jul 12, 2024
1 parent 210b5b6 commit 382a6d3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/parsing_graphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using FrameworkDemo

function main()
G = FrameworkDemo.parse_graphml(["./data/demo/sequencer/df.graphml"])
G = FrameworkDemo.parse_graphml("./data/demo/sequencer/df.graphml")
G_copy = deepcopy(G)
FrameworkDemo.show_graph(G_copy)
end
Expand Down
5 changes: 2 additions & 3 deletions src/parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ using Graphs
using MetaGraphs
include("../deps/GraphMLReader.jl/src/GraphMLReader.jl")

function parse_graphml(path)
file_path = joinpath(path...)
G = GraphMLReader.loadgraphml(file_path, "G")
function parse_graphml(filename::String)::MetaDiGraph
GraphMLReader.loadgraphml(filename, "G")
end

function show_graph(G)
Expand Down
2 changes: 1 addition & 1 deletion src/scheduling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function parse_graphs(graphs_map::Dict, output_graph_path::String, output_graph_
for (graph_name, graph_path) in graphs_map
parsed_graph_dot = timestamp_string("$output_graph_path$graph_name") * ".dot"
parsed_graph_image = timestamp_string("$output_graph_image_path$graph_name") * ".png"
G = parse_graphml([graph_path])
G = parse_graphml(graph_path)

open(parsed_graph_dot, "w") do f
MetaGraphs.savedot(f, G)
Expand Down
3 changes: 2 additions & 1 deletion test/parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ using Graphs
using MetaGraphs

@testset "Parsing" begin
graph = FrameworkDemo.parse_graphml(["../data/demo/sequencer/df.graphml"])
path = joinpath(pkgdir(FrameworkDemo), "data/demo/sequencer/df.graphml")
graph = FrameworkDemo.parse_graphml(path)
set_indexing_prop!(graph, :original_id)

# Test the general structure of the graph
Expand Down
3 changes: 2 additions & 1 deletion test/scheduling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ end


@testset verbose = true "Scheduling" begin
graph = FrameworkDemo.parse_graphml(["../data/demo/datadeps/df.graphml"])
path = joinpath(pkgdir(FrameworkDemo), "data/demo/datadeps/df.graphml")
graph = FrameworkDemo.parse_graphml(path)
ilength(x) = sum(_ -> 1, x) # no standard length for MetaGraphs.filter_vertices iterator
algorithms_count = ilength(MetaGraphs.filter_vertices(graph, :type, "Algorithm"))
set_indexing_prop!(graph, :node_id)
Expand Down

0 comments on commit 382a6d3

Please sign in to comment.