Skip to content

Commit

Permalink
fix(test): run tests from anywhere (#602)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaraney authored and christophertubbs committed May 7, 2024
1 parent 8483e34 commit 99e0b6b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions python/lib/evaluations/dmod/test/test_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import json
import typing
import pathlib

from datetime import datetime

Expand Down Expand Up @@ -525,9 +526,18 @@ def get_cfs_to_cfs_specification(cls) -> specification.EvaluationSpecification:
return specification.EvaluationSpecification.create(raw_config)

def setUp(self) -> None:
self._oldwd = os.getcwd()
# From repo root, this would be: `python/lib/evaluations`
evaluations = pathlib.Path(__file__).parent.parent.parent
# Testing data contains relative path dependencies.
# Change working directory so paths are resolved (see #602).
os.chdir(evaluations)
self.__cfs_to_cms_specification = self.get_cfs_to_cms_specification()
self.__cfs_to_cfs_specification = self.get_cfs_to_cfs_specification()

def tearDown(self) -> None:
os.chdir(self._oldwd)

def test_load_cfs_to_cfs(self):
cfs_to_cfs_evaluator = evaluate.Evaluator(self.__cfs_to_cfs_specification)
self.make_assertions(cfs_to_cfs_evaluator)
Expand Down

0 comments on commit 99e0b6b

Please sign in to comment.