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

Issue/231/test fail with env set #232

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@

import pytest

# Set "LEPHAREDIR" locally for tests if it is not already set.
if "LEPHAREDIR" not in os.environ:
test_dir = os.path.abspath(os.path.dirname(__file__))
os.environ["LEPHAREDIR"] = os.path.join(test_dir, "data")

# Set "LEPHAREWORK" locally for tests if it is not already set.
if "LEPHAREWORK" not in os.environ:
test_dir = os.path.abspath(os.path.dirname(__file__))
os.environ["LEPHAREWORK"] = os.path.join(test_dir, "tmp")
# Set "LEPHAREDIR" and "LEPHAREWORK" locally for tests whether or not already set.
test_dir = os.path.abspath(os.path.dirname(__file__))
os.environ["LEPHAREDIR"] = os.path.join(test_dir, "data")
os.environ["LEPHAREWORK"] = os.path.join(test_dir, "tmp")


@pytest.fixture
Expand Down
4 changes: 3 additions & 1 deletion tests/lephare/test_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def test_prepare(test_data_dir):
def test_load_sed_list(test_data_dir):
test_dir = os.path.abspath(os.path.dirname(__file__))
# Move one of the example sed folders
_ = shutil.copytree(os.path.join(test_dir, "../data/sed/QSO"), os.path.join(test_dir, "../tmp/seds"))
_ = shutil.copytree(
os.path.join(test_dir, "../data/sed/QSO"), os.path.join(test_dir, "../tmp/seds"), dirs_exist_ok=True
)
lp.load_sed_list(os.path.join(test_dir, "../tmp/seds/ONE_SED.list"), "QSO")
# Check the list is there
assert os.path.exists(os.path.join(test_dir, "../data/sed/QSO/ONE_SED/ONE_SED.list"))
Expand Down