Skip to content

Commit 34c8dcb

Browse files
committed
ci: Replace nose with pytest
1 parent ec11ff1 commit 34c8dcb

4 files changed

Lines changed: 37 additions & 37 deletions

File tree

ib3/tests/test_connection.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@
1515
#
1616
# You should have received a copy of the GNU General Public License along with
1717
# this program. If not, see <http://www.gnu.org/licenses/>.
18-
19-
try:
20-
from unittest import mock
21-
except ImportError:
22-
import mock
23-
2418
import ssl
2519

2620
import ib3
@@ -31,9 +25,9 @@ class SSLBot(ib3.connection.SSL, ib3.Bot):
3125
pass
3226

3327

34-
@mock.patch('irc.bot.SingleServerIRCBot.__init__')
35-
@mock.patch('irc.connection.Factory')
36-
def test_ssl(conn_factory, mock_init):
28+
def test_ssl(mocker):
29+
mock_init = mocker.patch('irc.bot.SingleServerIRCBot.__init__')
30+
conn_factory = mocker.patch('irc.connection.Factory')
3731
bot = SSLBot(
3832
server_list=[('localhost', '9999')],
3933
realname='ib3test',

setup.cfg

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,5 @@ show-pep8 = 1
99
show-source = 1
1010
statistics = 1
1111

12-
[nosetests]
13-
verbosity=2
14-
detailed-errors=1
15-
with-coverage=1
16-
with-doctest=1
17-
cover-package=ib3
18-
cover-html=1
19-
cover-html-dir=docs/_build/cover
20-
cover-branches=1
21-
2212
[wheel]
2313
universal = 1

setup.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@
22
# -*- coding: utf-8 -*-
33
import io
44
import setuptools
5-
import sys
65

76
setup_requires = [
87
'setuptools_scm>=1.15.0',
98
]
10-
if 'nosetests' in sys.argv[1:]:
11-
setup_requires.append('nose>=1.0')
129

1310
tests_require = [
14-
'coverage',
15-
"mock; python_version<'3.3'",
16-
'nose>=1.0',
11+
'pytest',
12+
'pytest-cov',
13+
'pytest-mock',
1714
]
1815

1916
name = 'ib3'

tox.ini

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
[tox]
2-
minversion=1.6
3-
skipsdist=True
4-
envlist=flake8,py37,py38,py39,py310,py311,docs
2+
minversion = 4.0
3+
envlist = flake8,py37,py38,py39,py310,py311,docs
4+
skip_missing_interpreters = true
55

66
[testenv]
77
deps=
88
-r{toxinidir}/requirements.txt
9-
coverage
10-
nose
9+
pytest
10+
pytest-cov
11+
pytest-mock
1112
setenv=
1213
PYTHONDONTWRITEBYTECODE=true
1314
commands=
14-
nosetests --with-doctest --doctest-tests -v --detailed-errors
15+
pytest ib3/
1516

1617
[testenv:docs]
1718
deps=
@@ -22,11 +23,29 @@ commands=
2223
sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html
2324

2425
[testenv:flake8]
25-
deps=flake8
26-
commands=flake8
26+
base_python = py311
27+
deps = flake8
28+
commands =
29+
flake8
2730

2831
[flake8]
29-
count=1
30-
show-pep8=1
31-
show-source=1
32-
statistics=1
32+
count = 1
33+
show-pep8 = 1
34+
show-source = 1
35+
statistics = 1
36+
37+
[pytest]
38+
addopts = --cov=ib3 --cov-report=term --cov-report=html --cov-report=xml
39+
40+
[coverage:run]
41+
branch = True
42+
43+
[coverage:report]
44+
show_missing = True
45+
skip_empty = True
46+
47+
[coverage:html]
48+
directory = dist/htmlcov
49+
50+
[coverage:xml]
51+
output = dist/coverage.xml

0 commit comments

Comments
 (0)