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

Replace tmpdir fixture with tmp_path #339

Merged
merged 1 commit into from
May 2, 2023
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
22 changes: 12 additions & 10 deletions tests/experiment/test_experiment_basic.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from io import StringIO
import json
from pathlib import Path
import prov
import pytest
import rdflib
from nidm.core import Constants
from nidm.experiment import Project, Session


def test_1(tmpdir):
tmpdir.chdir()
def test_1(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
monkeypatch.chdir(tmp_path)

project = Project()

Expand All @@ -16,8 +18,8 @@ def test_1(tmpdir):
f.write(project.serializeTurtle())


def test_2(tmpdir):
tmpdir.chdir()
def test_2(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
monkeypatch.chdir(tmp_path)

kwargs = {
Constants.NIDM_PROJECT_NAME: "FBIRN_PhaseII",
Expand All @@ -30,8 +32,8 @@ def test_2(tmpdir):
f.write(project.serializeTurtle())


def test_sessions_1(tmpdir):
tmpdir.chdir()
def test_sessions_1(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
monkeypatch.chdir(tmp_path)

project = Project()
assert project.sessions == []
Expand All @@ -46,8 +48,8 @@ def test_sessions_1(tmpdir):
assert session2.label == project.sessions[1].label


def test_sessions_2(tmpdir):
tmpdir.chdir()
def test_sessions_2(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
monkeypatch.chdir(tmp_path)

project = Project()
assert project.sessions == []
Expand All @@ -56,8 +58,8 @@ def test_sessions_2(tmpdir):
assert project.sessions[0].label == session1.label


def test_sessions_3(tmpdir):
tmpdir.chdir()
def test_sessions_3(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
monkeypatch.chdir(tmp_path)

project1 = Project()
project2 = Project()
Expand Down
10 changes: 4 additions & 6 deletions tests/workflows/test_workflows.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# from nidm.workflows import ProcessSpecification, ProcessExecution
#
#
# def test_processspec(tmpdir):
# def test_processspec(monkeypatch, tmp_path):
# #create new nidm-experiment document with project
# proc = ProcessSpecification()
#
# tmpdir.chdir()
# monkeypatch.chdir(tmp_path)
# #save a turtle file
# with open("test.ttl",'w') as f:
# f.write(proc.serializeTurtle())
Expand All @@ -14,16 +14,14 @@
# proc.save_DotGraph("test.png", format="png")
#
#
# def test_processexec(tmpdir):
# def test_processexec(monkeypatch, tmp_path):
# #create new nidm-experiment document with project
# proc = ProcessExecution()
#
# tmpdir.chdir()
# monkeypatch.chdir(tmp_path)
# #save a turtle file
# with open("test.ttl", 'w') as f:
# f.write(proc.serializeTurtle())
#
# #save a DOT graph as PDF
# proc.save_DotGraph("test.png", format="png")
#
#