Skip to content

Commit

Permalink
Run tests with pytest instead of nose (#863)
Browse files Browse the repository at this point in the history
Official nose documentation recommends users migrate to a more supported
platform.
  • Loading branch information
cottsay authored Apr 15, 2022
1 parent 6b05600 commit 9342649
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
python -m pip install --upgrade pip setuptools
python -m pip install PyYAML argparse rospkg vcstools catkin_pkg python-dateutil rosdistro
python -m pip install -e .
python -m pip install nose coverage flake8 mock codecov
python -m pip install pytest pytest-cov flake8 mock codecov
- name: Run tests
run: |
python -m nose --with-coverage --cover-package=rosdep2 --with-xunit test
python -m pytest test --cov
- name: Check coverage
run: |
python -m codecov
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ testsetup:
echo "running rosdep tests"

test: testsetup
nosetests --with-coverage --cover-package=rosdep2 --with-xunit test
cd test && pytest
6 changes: 3 additions & 3 deletions doc/developers_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ Setup

::

pip install nose
pip install pytest
pip install mock


rosdep2 uses `Python nose <http://readthedocs.org/docs/nose/en/latest/>`_
rosdep2 uses `pytest <http://docs.pytest.org>`_
for testing, which is a fairly simple and straightfoward test
framework. You just have to write a function start with the name
``test`` and use normal ``assert`` statements for your tests.
Expand All @@ -138,7 +138,7 @@ You can run the tests, including coverage, as follows:
::

cd rosdep2/test
nosetests
pytest


Documentation
Expand Down
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[tool:pytest]
junit_suite_name = rosdep

[coverage:run]
source = rosdep2
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
'packages': ['rosdep2', 'rosdep2.ament_packages', 'rosdep2.platforms'],
'package_dir': {'': 'src'},
'install_requires': ['catkin_pkg >= 0.4.0', 'rospkg >= 1.3.0', 'rosdistro >= 0.7.5', 'PyYAML >= 3.1'],
'test_suite': 'nose.collector',
'test_requires': ['mock', 'nose >= 1.0'],
'test_requires': ['mock', 'pytest'],
'author': 'Tully Foote, Ken Conley',
'author_email': '[email protected]',
'url': 'http://wiki.ros.org/rosdep',
Expand Down
6 changes: 6 additions & 0 deletions test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import os
import sys

sys.path.insert(0, os.path.join(
os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
'src'))

0 comments on commit 9342649

Please sign in to comment.