Skip to content

Commit

Permalink
Update conftest.py
Browse files Browse the repository at this point in the history
  • Loading branch information
CunliangGeng committed Mar 1, 2024
1 parent 8ea1e79 commit 47d8c12
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import os
import tempfile
import zipfile
from . import DATA_DIR


# Specify the config file via environment variable before importing nplinker in any test.
os.environ["NPLINKER_CONFIG_FILE"] = str(DATA_DIR / "nplinker_demo1.toml")
# Prepare dataset for local mode testing
# ⚠️ Multiple temp dirs will be created if using parallel testing.
temp_dir = tempfile.mkdtemp(prefix="nplinker_")
nplinker_root_dir = os.path.join(temp_dir, "local_mode_example")
with zipfile.ZipFile(DATA_DIR / "local_mode_example.zip", "r") as zip_ref:
zip_ref.extractall(temp_dir)

# NPLinker setting `root_dir` must be a path that exists, so setting it to a temporary directory.
os.environ["NPLINKER_ROOT_DIR"] = tempfile.mkdtemp(prefix="nplinker_")
os.environ["NPLINKER_ROOT_DIR"] = nplinker_root_dir

# Specify the config file via environment variable before importing nplinker in any test.
os.environ["NPLINKER_CONFIG_FILE"] = str(DATA_DIR / "nplinker_local_mode.toml")

0 comments on commit 47d8c12

Please sign in to comment.