Skip to content

Commit

Permalink
Mod: Set tmp path for unittests on Windows OS.
Browse files Browse the repository at this point in the history
  • Loading branch information
Labbeti committed Sep 18, 2023
1 parent 525197a commit ca44630
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_compare_cet.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from aac_metrics.functional.evaluate import evaluate
from aac_metrics.eval import load_csv_file
from aac_metrics.utils.paths import get_default_tmp_path
from aac_metrics.utils.paths import get_default_tmp_path, set_default_tmp_path


class TestCompareCaptionEvaluationTools(TestCase):
Expand All @@ -26,6 +26,10 @@ class TestCompareCaptionEvaluationTools(TestCase):
# Set Up methods
@classmethod
def setUpClass(cls) -> None:
if platform.system() == "Windows":
tmp_path = osp.join(".", "tmp")
os.makedirs(tmp_path, exist_ok=True)
set_default_tmp_path(tmp_path)
cls.evaluate_metrics_from_lists = cls._import_cet_eval_func()

@classmethod
Expand Down
12 changes: 12 additions & 0 deletions tests/test_doc_examples.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import os.path as osp
import platform
import unittest

from unittest import TestCase
Expand All @@ -13,9 +16,18 @@
preprocess_mono_sents,
preprocess_mult_sents,
)
from aac_metrics.utils.paths import set_default_tmp_path


class TestReadmeExamples(TestCase):
# Set Up methods
@classmethod
def setUpClass(cls) -> None:
if platform.system() == "Windows":
tmp_path = osp.join(".", "tmp")
os.makedirs(tmp_path, exist_ok=True)
set_default_tmp_path(tmp_path)

def test_example_1(self) -> None:
candidates: list[str] = ["a man is speaking", "rain falls"]
mult_references: list[list[str]] = [
Expand Down

0 comments on commit ca44630

Please sign in to comment.