Skip to content

Commit

Permalink
Merge pull request #148 from datalad/pytest
Browse files Browse the repository at this point in the history
Switch from nose to pytest
  • Loading branch information
adswa committed Jun 21, 2023
2 parents 8c4e792 + 8588e94 commit 429a845
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 26 deletions.
8 changes: 3 additions & 5 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ environment:
# MacOS core tests
- ID: MacP38core
DTS: datalad_xnat
APPVEYOR_BUILD_WORKER_IMAGE: macOS
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
PY: 3.8
INSTALL_GITANNEX: git-annex
DATALAD_LOCATIONS_SOCKETS: /Users/appveyor/DLTMP/sockets
Expand Down Expand Up @@ -183,10 +183,8 @@ test_script:
- cmd: md __testhome__
- sh: mkdir __testhome__
- cd __testhome__
# run test selecion (--traverse-namespace needed from Python 3.8 onwards)
- cmd: python -m nose --traverse-namespace -s -v -A "not (turtle)" --with-cov --cover-package datalad_xnat %DTS%
- sh: python -m nose --traverse-namespace -s -v -A "not (turtle)" --with-cov --cover-package datalad_xnat ${DTS}

- cmd: python -m pytest -s -v -m "not (turtle)" --cov=datalad_xnat --pyargs %DTS%
- sh: python -m pytest -s -v -m "not (turtle)" --cov=datalad_xnat --pyargs ${DTS}

after_test:
# move coverage into the project dir to make default handling applicable
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
run: |
git config --global user.email "test@github.land"
git config --global user.name "GitHub Almighty"
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test_crippledfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
run: |
git config --global user.email "test@github.land"
git config --global user.name "GitHub Almighty"
- uses: actions/checkout@v1
- name: Set up Python 3.6
uses: actions/setup-python@v1
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.6
python-version: 3.8
- name: Install dependencies
run: |
pip install -r requirements-devel.txt
Expand All @@ -52,4 +52,4 @@ jobs:
echo "== mount >>"
mount
echo "<< mount =="
python -m nose -s -v --with-doctest --with-coverage --cover-package datalad_xnat datalad_xnat
python -m pytest -s -v --cov=datalad_xnat --pyargs datalad_xnat
4 changes: 2 additions & 2 deletions datalad_xnat/tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
Dataset,
xnat_init,
)
from datalad.tests.utils import (
from datalad.tests.utils_pytest import (
assert_result_count,
with_tempfile,
)
from datalad.utils import Path


@with_tempfile
def test_invalid_url(dspath):
def test_invalid_url(dspath=None):

dspath = Path(dspath)

Expand Down
4 changes: 2 additions & 2 deletions datalad_xnat/tests/test_nitrcir.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Dataset,
)

from datalad.tests.utils import (
from datalad.tests.utils_pytest import (
assert_equal,
assert_in,
assert_in_results,
Expand Down Expand Up @@ -86,7 +86,7 @@ def test_anonymous_access_platform():


@with_tempfile
def test_anonymous_access_api(path):
def test_anonymous_access_api(path=None):
# test command usage w/ anonymous access to nitrc-ir

ds = Dataset(path).create()
Expand Down
6 changes: 3 additions & 3 deletions datalad_xnat/tests/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
xnat_update,
)

from datalad.tests.utils import (
from datalad.tests.utils_pytest import (
assert_in_results,
with_tempfile,
)

from datalad_xnat.init import _cfg_dataset


def fake_init(path):
def fake_init(path=None):
"""Do whatever is needed to xnat-init() a fresh dataset without talking
to a real XNAT instance
"""
Expand All @@ -43,7 +43,7 @@ def fake_init(path):


@with_tempfile
def test_invalid(path):
def test_invalid(path=None):
ds = fake_init(path)
(ds.pathobj / 'dirty').write_text('dirt')
# refuses to work on dirty datasets
Expand Down
4 changes: 2 additions & 2 deletions datalad_xnat/tests/test_xnatcentral.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Dataset,
)

from datalad.tests.utils import (
from datalad.tests.utils_pytest import (
assert_equal,
assert_in,
assert_in_results,
Expand Down Expand Up @@ -86,7 +86,7 @@ def test_anonymous_access_platform():


@with_tempfile
def test_anonymous_access_api(path):
def test_anonymous_access_api(path=None):
# test command usage w/ anonymous access to xnatcentral

ds = Dataset(path).create()
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
todo_include_todos = True

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
intersphinx_mapping = {"python": ('https://docs.python.org/3', None)}

# -- Options for HTML output ----------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions requirements-devel.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# requirements for a development environment
nose
coverage
pytest
pytest-cov
sphinx
sphinx_rtd_theme
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ include_package_data = True
[options.extras_require]
# this matches the name used by -core and what is expected by some CI setups
devel =
nose
coverage
pytest
pytest-cov

[options.packages.find]
# do not ship the build helpers
Expand Down

0 comments on commit 429a845

Please sign in to comment.