Skip to content
Snippets Groups Projects
Commit 09069b09 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Replace nose with pytest

parent 96d3446c
Branches
Tags
1 merge request!40Replace nose with pytest
Pipeline #60855 passed
......@@ -10,10 +10,11 @@
import os
# import bob.io.image
import nose
import numpy
# import bob.io.image
import pytest
from bob.io.base import load, write
from ..test_utils import datafile, temporary_filename
......@@ -147,11 +148,8 @@ def test_image_load():
load(full_file).shape == (100, 100)
# Testing exception
nose.tools.assert_raises(
RuntimeError,
lambda x: load(os.path.splitext(x)[0] + ".unknown"),
full_file,
)
with pytest.raises(RuntimeError):
load(os.path.splitext(full_file)[0] + ".unknown")
def test_image_exceptions():
......
import os
import nose
import numpy as np
import pytest
from bob.io.base import load, save, vstack_features
......@@ -64,7 +64,7 @@ def test_io_vstack():
]:
np.all(vstack_features(reader, paths, True) == oracle(reader, paths))
with nose.tools.assert_raises(AssertionError):
with pytest.raises(AssertionError):
vstack_features(reader_wrong_size, paths)
# test actual files
......@@ -89,7 +89,7 @@ def test_io_vstack():
np.all(vstack_features(load, paths) == reference)
os.remove(paths[0])
# Check if RuntimeError is raised when one of the files is missing
with nose.tools.assert_raises(RuntimeError):
with pytest.raises(RuntimeError):
vstack_features(load, paths)
finally:
try:
......
......@@ -10,8 +10,7 @@
import functools
import os
import nose.plugins.skip
import unittest
def datafile(f, module=None, path="data"):
......@@ -110,7 +109,7 @@ def extension_available(extension):
if extension in extensions():
return test(*args, **kwargs)
else:
raise nose.plugins.skip.SkipTest(
raise unittest.SkipTest(
'Extension to handle "%s" files was not available at compile time'
% extension
)
......
......@@ -38,13 +38,14 @@ test:
imports:
- {{ name }}
commands:
- nosetests --with-coverage --cover-package={{ name }} -sv {{ name }}
- pytest --verbose --cov {{ name }} --cov-report term-missing --cov-report html:{{ project_dir }}/sphinx/coverage --cov-report xml:{{ project_dir }}/coverage.xml --pyargs {{ name }}
- sphinx-build -aEW {{ project_dir }}/doc {{ project_dir }}/sphinx
- sphinx-build -aEb doctest {{ project_dir }}/doc sphinx
- conda inspect linkages -p $PREFIX {{ name }} # [not win]
- conda inspect objects -p $PREFIX {{ name }} # [osx]
requires:
- nose {{ nose }}
- pytest {{ pytest }}
- pytest-cov {{ pytest_cov }}
- coverage {{ coverage }}
- sphinx {{ sphinx }}
- sphinx_rtd_theme {{ sphinx_rtd_theme }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment