Skip to content

Commit

Permalink
Merge pull request #339 from incf-nidash/tmpdir
Browse files Browse the repository at this point in the history
Replace `tmpdir` fixture with `tmp_path`
  • Loading branch information
yarikoptic authored May 2, 2023
2 parents fea76cc + 419afc4 commit 1b34fcc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
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")
#
#

0 comments on commit 1b34fcc

Please sign in to comment.