Skip to content

Commit

Permalink
Switch from nose to pytest
Browse files Browse the repository at this point in the history
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
  • Loading branch information
carlwgeorge authored and Byron committed Feb 10, 2022
1 parent 2913a64 commit e3a4cfe
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
PYTHON = python
SETUP = $(PYTHON) setup.py
TESTRUNNER = $(shell which nosetests)
TESTFLAGS =

all::
Expand Down Expand Up @@ -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

4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
======
Expand All @@ -45,7 +45,7 @@ Once the clone is complete, please be sure to initialize the submodules using

Run the tests with

nosetests
pytest

DEVELOPMENT
===========
Expand Down
3 changes: 1 addition & 2 deletions gitdb.pro.user
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions gitdb/test/db/test_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
import random
import sys

from nose.plugins.skip import SkipTest
import pytest

class TestPackDB(TestDBBase):

@with_rw_directory
@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)

Expand Down
4 changes: 2 additions & 2 deletions gitdb/test/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions gitdb/test/test_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from gitdb.exc import UnsupportedOperation
from gitdb.util import to_bin_sha

from nose import SkipTest
import pytest

import os
import tempfile
Expand Down Expand Up @@ -246,4 +246,4 @@ def rewind_streams():
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')

0 comments on commit e3a4cfe

Please sign in to comment.