From 482d22636948b9e1bc6eea98157f9e53abc028ef Mon Sep 17 00:00:00 2001 From: vinicvaz Date: Tue, 23 Jul 2024 17:26:41 -0300 Subject: [PATCH] fix test init project --- tests/conftest.py | 2 +- tests/test_initialize_project.py | 26 ++++++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 0ba06b37..fff4257b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -31,7 +31,7 @@ def init_project( return config, project_data -@fixture(scope='function') +@fixture(scope='session') def setup_project_from_folder(): project = 'test_project_from_folder' videos = ['./tests/tests_project_sample_data'] diff --git a/tests/test_initialize_project.py b/tests/test_initialize_project.py index 1f8eef25..34f6af04 100644 --- a/tests/test_initialize_project.py +++ b/tests/test_initialize_project.py @@ -1,6 +1,7 @@ from pathlib import Path from vame.util.auxiliary import read_config from vame import init_new_project +import shutil def test_project_config_exists(setup_project_not_aligned_data): @@ -18,13 +19,26 @@ def test_project_name_config(setup_project_not_aligned_data): assert config_values['Project'] == setup_project_not_aligned_data['project_name'] -def test_existing_project(setup_project_not_aligned_data): - init_new_project( - project=setup_project_not_aligned_data['project_name'], - videos=setup_project_not_aligned_data['videos'], - poses_estimations=setup_project_not_aligned_data['videos'], - working_directory='./tests' +def test_existing_project(): + project = 'test_existing_project' + videos = ['./tests/tests_project_sample_data/cropped_video.mp4'] + poses_estimations = ['./tests/tests_project_sample_data/cropped_video.csv'] + working_directory = './tests' + + config_path_creation = init_new_project( + project=project, + videos=videos, + poses_estimations=poses_estimations, + working_directory=working_directory + ) + config_path_duplicated = init_new_project( + project=project, + videos=videos, + poses_estimations=poses_estimations, + working_directory=working_directory ) + assert config_path_creation == config_path_duplicated + shutil.rmtree(Path(config_path_creation).parent) def test_existing_project_from_folder(setup_project_from_folder):