From 8c5960598f41bd003fe0433cc7cf0771085501ce3b6c70823aaa66e2d073100d Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 1 Nov 2021 04:48:34 +0000 Subject: [PATCH] - Add patch remove-nose.patch: * Stop requiring nose for the test suite. - Add patch fix-mocking.patch: * Use correct form of mocking for a UNIX domain socket test. - Use pytest to run the test suite. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-vncdotool?expand=0&rev=4 --- fix-mocking.patch | 22 ++++++++++++++++++++++ python-vncdotool.changes | 9 +++++++++ python-vncdotool.spec | 8 +++++--- remove-nose.patch | 24 ++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 fix-mocking.patch create mode 100644 remove-nose.patch diff --git a/fix-mocking.patch b/fix-mocking.patch new file mode 100644 index 0000000..20d6a22 --- /dev/null +++ b/fix-mocking.patch @@ -0,0 +1,22 @@ +Index: vncdotool-1.0.0/tests/unit/test_command.py +=================================================================== +--- vncdotool-1.0.0.orig/tests/unit/test_command.py ++++ vncdotool-1.0.0/tests/unit/test_command.py +@@ -1,5 +1,6 @@ + from vncdotool import command + ++import os.path + import socket + import unittest + import mock +@@ -207,8 +208,8 @@ class TestParseServer(object): + assert port == 1111 + + def test_unix_socket(self): +- command.os.path.exists.return_value = True +- family, host, port = command.parse_server('/some/path/unix.skt') ++ with mock.patch.object(os.path, 'exists', return_value=True): ++ family, host, port = command.parse_server('/some/path/unix.skt') + assert family == socket.AF_UNIX + assert host == '/some/path/unix.skt' + assert port == 5900 diff --git a/python-vncdotool.changes b/python-vncdotool.changes index 56f3f31..6d6378b 100644 --- a/python-vncdotool.changes +++ b/python-vncdotool.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Mon Nov 1 04:47:41 UTC 2021 - Steve Kowalik + +- Add patch remove-nose.patch: + * Stop requiring nose for the test suite. +- Add patch fix-mocking.patch: + * Use correct form of mocking for a UNIX domain socket test. +- Use pytest to run the test suite. + ------------------------------------------------------------------- Wed Oct 6 10:31:59 UTC 2021 - Axel Braun diff --git a/python-vncdotool.spec b/python-vncdotool.spec index a1a61fa..b853b12 100644 --- a/python-vncdotool.spec +++ b/python-vncdotool.spec @@ -23,9 +23,10 @@ Version: 1.0.0 Release: 0 Summary: Command line VNC client License: MIT -Group: Development/Languages/Python URL: https://github.com/sibson/vncdotool Source: https://files.pythonhosted.org/packages/source/v/vncdotool/vncdotool-%{version}.tar.gz +Patch0: remove-nose.patch +Patch1: fix-mocking.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -38,8 +39,8 @@ BuildArch: noarch BuildRequires: %{python_module Pillow} BuildRequires: %{python_module Twisted} BuildRequires: %{python_module mock} -BuildRequires: %{python_module nose} BuildRequires: %{python_module pexpect} +BuildRequires: %{python_module pytest} # /SECTION %python_subpackages @@ -48,6 +49,7 @@ Command line VNC client. %prep %setup -q -n vncdotool-%{version} +%autopatch -p1 sed -i 's/from unittest.mock import /from mock.mock import /' tests/unit/helpers.py %build @@ -71,7 +73,7 @@ sed -i 's/from unittest.mock import /from mock.mock import /' tests/unit/helpers %python_uninstall_alternative vnclog %check -%python_exec setup.py test +%pytest -k 'not functional' %files %{python_files} %doc README.rst diff --git a/remove-nose.patch b/remove-nose.patch new file mode 100644 index 0000000..f700206 --- /dev/null +++ b/remove-nose.patch @@ -0,0 +1,24 @@ +Index: vncdotool-1.0.0/tests/unit/test_client.py +=================================================================== +--- vncdotool-1.0.0.orig/tests/unit/test_client.py ++++ vncdotool-1.0.0/tests/unit/test_client.py +@@ -1,6 +1,5 @@ +-from unittest import TestCase ++from unittest import SkipTest, TestCase + +-from nose.plugins.skip import SkipTest + import mock + + from vncdotool import client +Index: vncdotool-1.0.0/setup.py +=================================================================== +--- vncdotool-1.0.0.orig/setup.py ++++ vncdotool-1.0.0/setup.py +@@ -14,7 +14,6 @@ setup( + "Pillow", + ], + tests_require=[ +- 'nose', + 'pexpect', + ], + url='http://github.com/sibson/vncdotool',