Skip to content
Snippets Groups Projects
Commit 32acd76b authored by Maël Madon's avatar Maël Madon
Browse files

test: add test for graph feature

parent 96fd8f53
No related branches found
No related tags found
No related merge requests found
import sys import sys
from conftest import * from conftest import *
sys.path.append('../user_session_decompo')
from swf2sessions import swf2sessions
import os, subprocess import os, subprocess
import pytest import pytest
...@@ -18,11 +16,14 @@ def run_test(delim, ...@@ -18,11 +16,14 @@ def run_test(delim,
out_dir = os.path.abspath(f'test-out/{test_name}') out_dir = os.path.abspath(f'test-out/{test_name}')
create_dir_rec_if_needed(out_dir) create_dir_rec_if_needed(out_dir)
cp = subprocess.run( if not graph:
['python3', 'swf2sessions.py', '-at', str(threshold), input_swf, out_dir], cp = subprocess.run(['python3', 'swf2sessions.py',
check=True) '-at', str(threshold), '-q', input_swf, out_dir],
check=True)
swf2sessions(input_swf, out_dir, delim, threshold, dyn_red, graph, False) else:
cp = subprocess.run(['python3', 'swf2sessions.py',
'-at', str(threshold), '--graph', '-q', input_swf, out_dir],
check=True)
return out_dir, cp return out_dir, cp
...@@ -72,6 +73,17 @@ def test_kth_delim_max(): ...@@ -72,6 +73,17 @@ def test_kth_delim_max():
assert len(os.listdir(out_dir)) > 0 assert len(os.listdir(out_dir)) > 0
def test_graph():
"""Launch a couple of instances with the --graph option and checks if the graphs are output"""
instances = ["", "", ""]
instances[0], _ = run_test('arrival', 0, graph=True)
instances[1], _ = run_test('last', 30, graph=True)
instances[2], _ = run_test('max', 1440, graph=True)
for out_dir in instances:
assert os.path.exists(out_dir)
assert os.path.exists(f"{out_dir}/graphs")
assert len(os.listdir(f"{out_dir}/graphs")) == KTH_WL.nb_users
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment