diff options
author | Carl George <carl@george.computer> | 2022-02-09 17:15:39 -0600 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-02-10 10:23:48 +0800 |
commit | e3a4cfe0ef2bc7b9c785c4fec650f5045cdd1e50 (patch) | |
tree | 99f396b33867732f0cd3ab055c5f8ac1a2b8da69 | |
parent | 2913a6454c9dfc803679dc5f75315e2d821ee977 (diff) | |
download | gitdb-e3a4cfe0ef2bc7b9c785c4fec650f5045cdd1e50.tar.gz |
Switch from nose to pytest
This is not a full rewrite to pytest style tests, it just changes the
minimum to allow pytest to run the existing tests.
Resolves #72
-rw-r--r-- | .github/workflows/pythonpackage.yml | 6 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | README.rst | 4 | ||||
-rw-r--r-- | gitdb.pro.user | 3 | ||||
-rw-r--r-- | gitdb/test/db/test_pack.py | 4 | ||||
-rw-r--r-- | gitdb/test/lib.py | 4 | ||||
-rw-r--r-- | gitdb/test/test_pack.py | 4 |
7 files changed, 13 insertions, 15 deletions
diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 7f35b61..c695ad3 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -36,9 +36,9 @@ jobs: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with nose + - name: Test with pytest run: | - pip install nose + pip install pytest ulimit -n 48 ulimit -n - nosetests -v + pytest -v @@ -1,6 +1,5 @@ PYTHON = python SETUP = $(PYTHON) setup.py -TESTRUNNER = $(shell which nosetests) TESTFLAGS = all:: @@ -37,5 +36,5 @@ clean:: rm -f *.so coverage:: build - PYTHONPATH=. $(PYTHON) $(TESTRUNNER) --cover-package=gitdb --with-coverage --cover-erase --cover-inclusive gitdb + PYTHONPATH=. $(PYTHON) -m pytest --cov=gitdb gitdb @@ -30,7 +30,7 @@ If you want to go up to 20% faster, you can install gitdb-speedups with: REQUIREMENTS ============ -* Python Nose - for running the tests +* pytest - for running the tests SOURCE ====== @@ -45,7 +45,7 @@ Once the clone is complete, please be sure to initialize the submodules using Run the tests with - nosetests + pytest DEVELOPMENT =========== diff --git a/gitdb.pro.user b/gitdb.pro.user index 398cb70..3ca1e21 100644 --- a/gitdb.pro.user +++ b/gitdb.pro.user @@ -233,8 +233,7 @@ </valuemap> <valuemap key="ProjectExplorer.Target.RunConfiguration.1" type="QVariantMap"> <valuelist key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments" type="QVariantList"> - <value type="QString">/usr/bin/nosetests</value> - <value type="QString">-s</value> + <value type="QString">/usr/bin/pytest</value> <value type="QString">gitdb/test/test_pack.py</value> </valuelist> <value key="ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase" type="int">2</value> diff --git a/gitdb/test/db/test_pack.py b/gitdb/test/db/test_pack.py index ff96a58..4539f42 100644 --- a/gitdb/test/db/test_pack.py +++ b/gitdb/test/db/test_pack.py @@ -16,7 +16,7 @@ import os import random import sys -from nose.plugins.skip import SkipTest +import pytest class TestPackDB(TestDBBase): @@ -24,7 +24,7 @@ class TestPackDB(TestDBBase): @with_packs_rw def test_writing(self, path): if sys.platform == "win32": - raise SkipTest("FIXME: Currently fail on windows") + pytest.skip("FIXME: Currently fail on windows") pdb = PackedDB(path) diff --git a/gitdb/test/lib.py b/gitdb/test/lib.py index a04084f..abd4ad5 100644 --- a/gitdb/test/lib.py +++ b/gitdb/test/lib.py @@ -65,8 +65,8 @@ def skip_on_travis_ci(func): @wraps(func) def wrapper(self, *args, **kwargs): if 'TRAVIS' in os.environ: - import nose - raise nose.SkipTest("Cannot run on travis-ci") + import pytest + pytest.skip("Cannot run on travis-ci") # end check for travis ci return func(self, *args, **kwargs) # end wrapper diff --git a/gitdb/test/test_pack.py b/gitdb/test/test_pack.py index 4b01741..f946197 100644 --- a/gitdb/test/test_pack.py +++ b/gitdb/test/test_pack.py @@ -26,7 +26,7 @@ from gitdb.fun import delta_types from gitdb.exc import UnsupportedOperation from gitdb.util import to_bin_sha -from nose import SkipTest +import pytest import os import tempfile @@ -246,4 +246,4 @@ class TestPack(TestBase): def test_pack_64(self): # TODO: hex-edit a pack helping us to verify that we can handle 64 byte offsets # of course without really needing such a huge pack - raise SkipTest() + pytest.skip('not implemented') |