Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestEvaluate test must be run from python/lib/evaluations #602

Closed
aaraney opened this issue May 5, 2024 · 1 comment · Fixed by #603
Closed

TestEvaluate test must be run from python/lib/evaluations #602

aaraney opened this issue May 5, 2024 · 1 comment · Fixed by #603
Assignees
Labels
Low Hanging Fruit This should not take a lot of time

Comments

@aaraney
Copy link
Member

aaraney commented May 5, 2024

python/lib/evaluations/dmod/test/test_evaluate.py::TestEvaluate tests must be run from python/lib/evaluations or the tests fail.

Simple fix is changing to:

    def setUp(self) -> None:
        self.oldwd = os.getcwd()
        # from root, this would be: `python/lib/evaluations`
        evaluations = Path(__file__).parent.parent.parent
        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)

Not sure if this is exactly what we want or if this is more systemic. @christophertubbs, can you weigh in on this?

Edit: Changing the current working directory is necessary b.c. evaluate.Evaluator specification's can include backends (external resources) via relative or absolute file paths (see linked example). Tests in this test suite use specifications that define resources with relative file paths that improperly resolve when the tests are run from unexpected working directories.

@aaraney aaraney added the Low Hanging Fruit This should not take a lot of time label May 5, 2024
@aaraney
Copy link
Member Author

aaraney commented May 6, 2024

You can reproduce this issue by running the test from the root of the repo with python -m unittest python/lib/evaluations/dmod/test/test_evaluate.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Low Hanging Fruit This should not take a lot of time
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants