From f19945472ed53874eeb28fb1705b9393ba2b8ae3 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 20 Oct 2023 09:14:45 -0700 Subject: [PATCH] pytest: support non-top level dirs Generalize `basepath` to support running from any directory. --- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 6f3a490d..27104c44 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import itertools -import os +from pathlib import Path import pytest @@ -21,7 +21,7 @@ from mpi4py import MPI # noqa # base path for input files -basepath = os.getcwd() +basepath = Path(__file__).parent.parent @pytest.fixture(autouse=True, scope="function")