-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
autouse fork/spawn fixture so we test both
this is necessary for getting compatibility with windows and macos
- Loading branch information
Showing
2 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import multiprocessing as mp | ||
import os | ||
import yaml | ||
|
||
from dacapo.options import Options | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(params=["fork", "spawn"], autouse=True) | ||
def context(monkeypatch): | ||
ctx = mp.get_context("spawn") | ||
monkeypatch.setattr(mp, "Queue", ctx.Queue) | ||
monkeypatch.setattr(mp, "Process", ctx.Process) | ||
monkeypatch.setattr(mp, "Event", ctx.Event) | ||
monkeypatch.setattr(mp, "Value", ctx.Value) | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def runs_base_dir(tmpdir): | ||
options_file = tmpdir / "dacapo.yaml" | ||
os.environ["DACAPO_OPTIONS_FILE"] = f"{options_file}" | ||
|
||
with open(options_file, "w") as f: | ||
options_file.write(yaml.safe_dump({"runs_base_dir": f"{tmpdir}"})) | ||
|
||
assert Options.config_file() == options_file | ||
assert Options.instance().runs_base_dir == tmpdir |