forked from pool/python-pytest-shutil
Accepting request 971929 from home:bnavigator:branches:devel:languages:python:pytest
- Fixup fallout from SUSE's crusade against mock in the
pytest-fixtures family
* Replace remove-mock.patch with
pytest-fixtures-pr171-remove-mock.patch
* gh#man-group/pytest-plugins#171
* Update build and runtime requirements
OBS-URL: https://build.opensuse.org/request/show/971929
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-shutil?expand=0&rev=18
This commit is contained in:
72
pytest-fixtures-pr171-remove-mock.patch
Normal file
72
pytest-fixtures-pr171-remove-mock.patch
Normal file
@@ -0,0 +1,72 @@
|
||||
diff --git a/pytest-shutil/pytest_shutil/run.py b/pytest-shutil/pytest_shutil/run.py
|
||||
index c5b421d..7d46aea 100644
|
||||
--- a/pytest-shutil/pytest_shutil/run.py
|
||||
+++ b/pytest-shutil/pytest_shutil/run.py
|
||||
@@ -11,7 +11,12 @@
|
||||
from contextlib import closing
|
||||
import subprocess
|
||||
|
||||
-from mock import patch
|
||||
+try:
|
||||
+ from unittest.mock import patch
|
||||
+except ImportError:
|
||||
+ # python 2
|
||||
+ from mock import patch
|
||||
+
|
||||
import execnet
|
||||
from six.moves import cPickle # @UnresolvedImport
|
||||
|
||||
diff --git a/pytest-shutil/setup.py b/pytest-shutil/setup.py
|
||||
index 4126831..3513d3e 100644
|
||||
--- a/pytest-shutil/setup.py
|
||||
+++ b/pytest-shutil/setup.py
|
||||
@@ -24,10 +24,11 @@
|
||||
|
||||
install_requires = ['six',
|
||||
'execnet',
|
||||
- 'contextlib2',
|
||||
+ 'contextlib2;python_version<"3"',
|
||||
'pytest',
|
||||
- 'path.py',
|
||||
- 'mock',
|
||||
+ 'path; python_version >= "3.7"',
|
||||
+ 'path.py; python_version < "3.7"',
|
||||
+ 'mock; python_version<"3.3"',
|
||||
'termcolor'
|
||||
]
|
||||
|
||||
diff --git a/pytest-shutil/tests/integration/test_run_integration.py b/pytest-shutil/tests/integration/test_run_integration.py
|
||||
index d92c9da..bf20f3a 100644
|
||||
--- a/pytest-shutil/tests/integration/test_run_integration.py
|
||||
+++ b/pytest-shutil/tests/integration/test_run_integration.py
|
||||
@@ -8,7 +8,10 @@
|
||||
import textwrap
|
||||
from uuid import uuid4
|
||||
|
||||
-import mock
|
||||
+try:
|
||||
+ from unittest import mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
|
||||
from pytest_shutil import run, workspace
|
||||
from pytest_shutil.env import no_cov
|
||||
diff --git a/pytest-shutil/tests/unit/test_run.py b/pytest-shutil/tests/unit/test_run.py
|
||||
index 612d20d..c520e85 100644
|
||||
--- a/pytest-shutil/tests/unit/test_run.py
|
||||
+++ b/pytest-shutil/tests/unit/test_run.py
|
||||
@@ -3,7 +3,13 @@
|
||||
from subprocess import PIPE, STDOUT
|
||||
|
||||
import pytest
|
||||
-from mock import Mock, patch, sentinel, DEFAULT, call
|
||||
+
|
||||
+try:
|
||||
+ from unittest.mock import Mock, patch, sentinel, DEFAULT, call
|
||||
+except ImportError:
|
||||
+ # python 2
|
||||
+ from mock import Mock, patch, sentinel, DEFAULT, call
|
||||
+
|
||||
from six.moves import cPickle
|
||||
|
||||
from pytest_shutil import run
|
||||
Reference in New Issue
Block a user