Compare commits
30 Commits
Author | SHA256 | Date | |
---|---|---|---|
989d6a5666 | |||
72eeffa2d3 | |||
5aee9d9c26 | |||
65c5dd762b | |||
2d899255bd | |||
64646456ae | |||
62a2e771c9 | |||
fb5bfb5ba2 | |||
e3e23cea9f | |||
7c22bb8112 | |||
ea2f6b40dc | |||
6c42935ff8 | |||
260a48b701 | |||
2d1915341d | |||
b5eb38414d | |||
2bd6323dbd | |||
|
444dced185 | ||
ec4a1bfc70 | |||
355bb78ea7 | |||
82c80373e6 | |||
05bb53ad96 | |||
7b1b883a2f | |||
93876f418b | |||
8caf53a9a1 | |||
c9eef8e98e | |||
|
bac36e4614 | ||
3c212b59ce | |||
|
e822fc5575 | ||
7066029db9 | |||
|
e27ea20915 |
@@ -1,72 +0,0 @@
|
|||||||
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
|
|
BIN
pytest-shutil-1.7.0.tar.gz
(Stored with Git LFS)
BIN
pytest-shutil-1.7.0.tar.gz
(Stored with Git LFS)
Binary file not shown.
@@ -1,36 +0,0 @@
|
|||||||
From bbb9e5c7cba84fb4665a521569d1cfcca08ee4e5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
|
|
||||||
Date: Sat, 27 May 2023 18:05:44 +0200
|
|
||||||
Subject: [PATCH] pytest-shutil: Replace deprecated imp module
|
|
||||||
|
|
||||||
Replace the use of the deprecated `imp` module with `importlib.util',
|
|
||||||
as the former has been removed from Python 3.12.
|
|
||||||
---
|
|
||||||
pytest-shutil/pytest_shutil/run.py | 7 +++++--
|
|
||||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/pytest-shutil/pytest_shutil/run.py b/pytest-shutil/pytest_shutil/run.py
|
|
||||||
index 7d46aea1..08a6a34c 100644
|
|
||||||
--- a/pytest-shutil/pytest_shutil/run.py
|
|
||||||
+++ b/pytest-shutil/pytest_shutil/run.py
|
|
||||||
@@ -3,7 +3,7 @@
|
|
||||||
"""
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
-import imp
|
|
||||||
+import importlib.util
|
|
||||||
import logging
|
|
||||||
from functools import update_wrapper
|
|
||||||
import inspect
|
|
||||||
@@ -112,7 +112,10 @@ def run_module_as_main(module, argv=[]):
|
|
||||||
filename = os.path.splitext(filename)[0] + ".py"
|
|
||||||
|
|
||||||
with patch("sys.argv", new=argv):
|
|
||||||
- imp.load_source('__main__', os.path.join(where, filename))
|
|
||||||
+ spec = importlib.util.spec_from_file_location(
|
|
||||||
+ "__main__", os.path.join(where, filename))
|
|
||||||
+ module = importlib.util.module_from_spec(spec)
|
|
||||||
+ spec.loader.exec_module(module)
|
|
||||||
|
|
||||||
|
|
||||||
def _evaluate_fn_source(src, *args, **kwargs):
|
|
Reference in New Issue
Block a user