#10 Switch the test runner in %check from nose to pytest
Merged 2 years ago by churchyard. Opened 2 years ago by churchyard.
rpms/ churchyard/python-lockfile pytest  into  rawhide

file added
+45
@@ -0,0 +1,45 @@ 

+ diff --git a/test-requirements.txt b/test-requirements.txt

+ index 446a41f..0bf6dc3 100644

+ --- a/test-requirements.txt

+ +++ b/test-requirements.txt

+ @@ -1,5 +1,5 @@

+  # The order of packages is significant, because pip processes them in the order

+  # of appearance. Changing the order has an impact on the overall integration

+  # process, which may cause wedges in the gate later.

+ -nose

+ +pytest

+  sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2

+ diff --git a/test/compliancetest.py b/test/compliancetest.py

+ index bf4e59c..a7285de 100644

+ --- a/test/compliancetest.py

+ +++ b/test/compliancetest.py

+ @@ -6,15 +6,13 @@ import lockfile

+  

+  

+  class ComplianceTest(object):

+ -    def __init__(self):

+ -        self.saved_class = lockfile.LockFile

+ -

+      def _testfile(self):

+          """Return platform-appropriate file.  Helper for tests."""

+          import tempfile

+          return os.path.join(tempfile.gettempdir(), 'trash-%s' % os.getpid())

+  

+      def setup(self):

+ +        self.saved_class = lockfile.LockFile

+          lockfile.LockFile = self.class_to_test

+  

+      def teardown(self):

+ diff --git a/tox.ini b/tox.ini

+ index 750ad5f..7bfd923 100644

+ --- a/tox.ini

+ +++ b/tox.ini

+ @@ -4,7 +4,7 @@ envlist = py27,py32,py33,py34

+  

+  [testenv]

+  deps = -r{toxinidir}/test-requirements.txt

+ -commands=nosetests

+ +commands=pytest

+  

+  [testenv:venv]

+  commands = {posargs}

file modified
+12 -4
@@ -15,12 +15,17 @@ 

  Summary:        Platform-independent file locking module

  Epoch:          1

  Version:        0.12.2

- Release:        6%{?dist}

+ Release:        7%{?dist}

  License:        MIT

  

  URL:            https://github.com/openstack/pylockfile

  Source0:        %{pypi_source}

  

+ # Remove __init__ method from Test classes to be able to use pytest

+ # Update all metadata from nose to pytest

+ # Upstream is dead so this is downstream only

+ Patch:          pytest.patch

+ 

  BuildArch:      noarch

  

  BuildRequires:  python3-devel
@@ -30,7 +35,7 @@ 

  BuildRequires:  python3dist(sphinx)

  

  %if %{with tests}

- BuildRequires:  python3dist(nose)

+ BuildRequires:  python3dist(pytest)

  %endif

  

  %description %{common_description}
@@ -50,7 +55,7 @@ 

  

  

  %prep

- %autosetup -n %{pypi_name}-%{version}

+ %autosetup -p1 -n %{pypi_name}-%{version}

  

  # Remove bundled egg-info

  rm -rf %{pypi_name}.egg-info
@@ -71,7 +76,7 @@ 

  

  %check

  %if %{with tests}

- PYTHONPATH=$(pwd) nosetests-3

+ %pytest

  %endif

  

  
@@ -88,6 +93,9 @@ 

  

  

  %changelog

+ * Thu Jun 23 2022 Miro Hrončok <mhroncok@redhat.com> - 1:0.12.2-7

+ - Switch the test runner in %%check from nose to pytest

+ 

  * Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 1:0.12.2-6

  - Rebuilt for Python 3.11

  

no initial comment

rebased onto d5f9b97

2 years ago

Looks good to me and works well.

Pull-Request has been merged by churchyard

2 years ago
Metadata