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

Merge branch 'deprecation' into 'master'

Replace nose with pytest

See merge request !40
parents 96d3446c 09069b09
No related branches found
No related tags found
1 merge request!40Replace nose with pytest
Pipeline #60859 passed
...@@ -10,10 +10,11 @@ ...@@ -10,10 +10,11 @@
import os import os
# import bob.io.image
import nose
import numpy import numpy
# import bob.io.image
import pytest
from bob.io.base import load, write from bob.io.base import load, write
from ..test_utils import datafile, temporary_filename from ..test_utils import datafile, temporary_filename
...@@ -147,11 +148,8 @@ def test_image_load(): ...@@ -147,11 +148,8 @@ def test_image_load():
load(full_file).shape == (100, 100) load(full_file).shape == (100, 100)
# Testing exception # Testing exception
nose.tools.assert_raises( with pytest.raises(RuntimeError):
RuntimeError, load(os.path.splitext(full_file)[0] + ".unknown")
lambda x: load(os.path.splitext(x)[0] + ".unknown"),
full_file,
)
def test_image_exceptions(): def test_image_exceptions():
......
import os import os
import nose
import numpy as np import numpy as np
import pytest
from bob.io.base import load, save, vstack_features from bob.io.base import load, save, vstack_features
...@@ -64,7 +64,7 @@ def test_io_vstack(): ...@@ -64,7 +64,7 @@ def test_io_vstack():
]: ]:
np.all(vstack_features(reader, paths, True) == oracle(reader, paths)) 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) vstack_features(reader_wrong_size, paths)
# test actual files # test actual files
...@@ -89,7 +89,7 @@ def test_io_vstack(): ...@@ -89,7 +89,7 @@ def test_io_vstack():
np.all(vstack_features(load, paths) == reference) np.all(vstack_features(load, paths) == reference)
os.remove(paths[0]) os.remove(paths[0])
# Check if RuntimeError is raised when one of the files is missing # 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) vstack_features(load, paths)
finally: finally:
try: try:
......
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
import functools import functools
import os import os
import unittest
import nose.plugins.skip
def datafile(f, module=None, path="data"): def datafile(f, module=None, path="data"):
...@@ -110,7 +109,7 @@ def extension_available(extension): ...@@ -110,7 +109,7 @@ def extension_available(extension):
if extension in extensions(): if extension in extensions():
return test(*args, **kwargs) return test(*args, **kwargs)
else: else:
raise nose.plugins.skip.SkipTest( raise unittest.SkipTest(
'Extension to handle "%s" files was not available at compile time' 'Extension to handle "%s" files was not available at compile time'
% extension % extension
) )
......
...@@ -38,13 +38,14 @@ test: ...@@ -38,13 +38,14 @@ test:
imports: imports:
- {{ name }} - {{ name }}
commands: 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 -aEW {{ project_dir }}/doc {{ project_dir }}/sphinx
- sphinx-build -aEb doctest {{ project_dir }}/doc sphinx - sphinx-build -aEb doctest {{ project_dir }}/doc sphinx
- conda inspect linkages -p $PREFIX {{ name }} # [not win] - conda inspect linkages -p $PREFIX {{ name }} # [not win]
- conda inspect objects -p $PREFIX {{ name }} # [osx] - conda inspect objects -p $PREFIX {{ name }} # [osx]
requires: requires:
- nose {{ nose }} - pytest {{ pytest }}
- pytest-cov {{ pytest_cov }}
- coverage {{ coverage }} - coverage {{ coverage }}
- sphinx {{ sphinx }} - sphinx {{ sphinx }}
- sphinx_rtd_theme {{ sphinx_rtd_theme }} - 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