Skip to content

Commit

Permalink
Merge pull request #280 from neutrinoceros/tst/move_Parameters_tests
Browse files Browse the repository at this point in the history
TST: move Parameters tests to dedicated module
  • Loading branch information
neutrinoceros authored Mar 24, 2024
2 parents a771cd7 + 5384fc6 commit 7e8e499
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
10 changes: 0 additions & 10 deletions tests/test_errors.py

This file was deleted.

13 changes: 0 additions & 13 deletions tests/test_load_config.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
import os
import sys

import inifix
import pytest

from nonos.api import Parameters
from nonos.config import DEFAULTS
from nonos.main import main


@pytest.mark.skipif(sys.platform.startswith("win"), reason="does not run on windows")
def test_config_dir_not_found(tmp_path):
with pytest.raises(FileNotFoundError, match=r"not found"):
Parameters(inifile="notafile", code="idefix", directory=tmp_path)


def test_config_inifile_but_nocode(tmp_path):
with pytest.raises(ValueError, match=r"both inifile and code have to be given"):
Parameters(inifile="notafile", directory=tmp_path)


@pytest.fixture()
def minimal_paramfile(tmp_path):
ifile = tmp_path / "nonos.ini"
Expand Down
25 changes: 25 additions & 0 deletions tests/test_parameters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
import sys

import pytest

from nonos.api import Parameters


def test_init_params_wo_a_file(tmp_path):
os.chdir(tmp_path)
with pytest.raises(
FileNotFoundError, match=r"idefix.ini, pluto.ini, variables.par not found"
):
Parameters()


@pytest.mark.skipif(sys.platform.startswith("win"), reason="does not run on windows")
def test_config_dir_not_found(tmp_path):
with pytest.raises(FileNotFoundError, match=r"not found"):
Parameters(inifile="notafile", code="idefix", directory=tmp_path)


def test_config_inifile_but_nocode(tmp_path):
with pytest.raises(ValueError, match=r"both inifile and code have to be given"):
Parameters(inifile="notafile", directory=tmp_path)

0 comments on commit 7e8e499

Please sign in to comment.