diff --git a/bob/io/base/test/test_image_support.py b/bob/io/base/test/test_image_support.py index 04e1721581f0e535e1f9c4ded8a201de8c9644e7..78f3cd2a8d2584d43bad465d1376007953f3f060 100644 --- a/bob/io/base/test/test_image_support.py +++ b/bob/io/base/test/test_image_support.py @@ -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(): diff --git a/bob/io/base/test/test_io.py b/bob/io/base/test/test_io.py index 22b8fca959749fccdda33926e509d624693e64d6..de57e65c718097b511f05690735f128248e609dc 100644 --- a/bob/io/base/test/test_io.py +++ b/bob/io/base/test/test_io.py @@ -1,7 +1,7 @@ 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: diff --git a/bob/io/base/test_utils.py b/bob/io/base/test_utils.py index 6d8f3a059f1048ba23c8e481a138718dc2735d8d..6156c4b459b6e10085b557471447daadadfb346b 100644 --- a/bob/io/base/test_utils.py +++ b/bob/io/base/test_utils.py @@ -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 ) diff --git a/conda/meta.yaml b/conda/meta.yaml index 2c121cf51b4c7f8f3eb28cb03b87c972639e0629..7f9bf577668dc920a97055fe5f0d5ac715b38f0c 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -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 }}