Skip to content

Commit 8d4e7de

Browse files
committed
fix #232 : replaced nose by pytest
1 parent b1b69b6 commit 8d4e7de

File tree

6 files changed

+21
-14
lines changed

6 files changed

+21
-14
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ install:
4747
# except scipy and install pandas with --no-deps
4848
- conda create -n travisci --yes python=${TRAVIS_PYTHON_VERSION:0:3}
4949
numpy pandas pytables pyqt qtpy matplotlib xlrd openpyxl
50-
xlsxwriter nose
50+
xlsxwriter pytest
5151
- source activate travisci
5252

5353
script:
5454
# exclude (doc)tests from ufuncs (because docstrings are copied from numpy
5555
# and many of those doctests are failing
56-
- nosetests -v --with-doctest --exclude=larray.ufuncs
56+
- pytest
5757

5858
notifications:
5959
on_success: "change"

larray/tests/test_ipfp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import absolute_import, division, print_function
22

33
from unittest import TestCase
4-
import unittest
4+
import pytest
55

66
from larray import Axis, LArray, ndrange
77
from larray.tests.test_la import assert_array_equal

larray/tests/test_la.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os.path
44
import sys
55
from unittest import TestCase
6-
import unittest
6+
import pytest
77

88
import numpy as np
99
import pandas as pd
@@ -3319,7 +3319,7 @@ def test_read_eurostat(self):
33193319
assert_array_equal(la[x.arr['1'], '0', 'F', x.nat['1'], :],
33203320
[3722, 3395, 3347])
33213321

3322-
@unittest.skipIf(xw is None, "xlwings is not available")
3322+
@pytest.mark.skipif(xw is None, reason="xlwings is not available")
33233323
def test_read_excel_xlwings(self):
33243324
la = read_excel(abspath('test.xlsx'), '1d')
33253325
self.assertEqual(la.ndim, 1)
@@ -3555,7 +3555,7 @@ def test_to_excel_xlsxwriter(self):
35553555
res = read_excel(fpath, 'other', engine='xlrd')
35563556
assert_array_equal(res, a3)
35573557

3558-
@unittest.skipIf(xw is None, "xlwings is not available")
3558+
@pytest.mark.skipif(xw is None, reason="xlwings is not available")
35593559
def test_to_excel_xlwings(self):
35603560
# TODO: we should implement an app= argument to to_excel to reuse the same Excel instance
35613561
fpath = abspath('test_to_excel_xlwings.xlsx')
@@ -3613,7 +3613,7 @@ def test_to_excel_xlwings(self):
36133613
res = read_excel(fpath, 'other', engine='xlrd')
36143614
assert_array_equal(res, a3)
36153615

3616-
@unittest.skipIf(xw is None, "xlwings is not available")
3616+
@pytest.mark.skipif(xw is None, reason="xlwings is not available")
36173617
def test_open_excel(self):
36183618
# use a single Excel instance to speed up the test
36193619
app = xw.App(visible=False, add_book=False)
@@ -3891,7 +3891,7 @@ def test_diag(self):
38913891
self.assertEqual(d.i[0], 1.0)
38923892
self.assertEqual(d.i[1], 1.0)
38933893

3894-
@unittest.skipIf(sys.version_info < (3, 5), "@ unavailable (Python < 3.5)")
3894+
@pytest.mark.skipif(sys.version_info < (3, 5), reason="@ unavailable (Python < 3.5)")
38953895
def test_matmul(self):
38963896
# 2D / anonymous axes
38973897
a1 = eye(3) * 2
@@ -4046,7 +4046,7 @@ def test_matmul(self):
40464046
assert_array_equal(arr2d.__matmul__(arr4d), res)
40474047

40484048

4049-
@unittest.skipIf(sys.version_info < (3, 5), "@ unavailable (Python < 3.5)")
4049+
@pytest.mark.skipif(sys.version_info < (3, 5), reason="@ unavailable (Python < 3.5)")
40504050
def test_rmatmul(self):
40514051
a1 = eye(3) * 2
40524052
a2 = ndrange((3, 3))

larray/tests/test_session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import absolute_import, division, print_function
22

33
from unittest import TestCase
4-
import unittest
4+
import pytest
55

66
import numpy as np
77

setup.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[aliases]
2+
test=pytest
3+
4+
[tool:pytest]
5+
testpaths = larray
6+
addopts = -v --doctest-modules --ignore=larray/ufuncs.py
7+
#--maxfail=1 --cov (requires pytest-cov) --pep8 (requires pytest-pep8)
8+
#pep8maxlinelength = 119

setup.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import os
44
from setuptools import setup, find_packages
55

6-
76
def readlocal(fname):
87
return open(os.path.join(os.path.dirname(__file__), fname)).read()
98

@@ -15,8 +14,8 @@ def readlocal(fname):
1514
DESCRIPTION = "N-D labeled arrays in Python"
1615
LONG_DESCRIPTION = readlocal("README.rst")
1716
INSTALL_REQUIRES = ['numpy >= 1.10', 'pandas >= 0.13.1']
18-
TESTS_REQUIRE = ['nose >= 1.0']
19-
TEST_SUITE = 'nose.collector'
17+
TESTS_REQUIRE = ['pytest']
18+
SETUP_REQUIRES = ['pytest-runner']
2019

2120
LICENSE = 'GPLv3'
2221
PACKAGE_DATA = {'larray': ['tests/data/*']}
@@ -50,8 +49,8 @@ def readlocal(fname):
5049
long_description=LONG_DESCRIPTION,
5150
install_requires=INSTALL_REQUIRES,
5251
tests_require=TESTS_REQUIRE,
52+
setup_requires=SETUP_REQUIRES,
5353
url=URL,
54-
test_suite=TEST_SUITE,
5554
packages=find_packages(),
5655
package_data=PACKAGE_DATA,
5756
)

0 commit comments

Comments
 (0)