- Remove not needed dep python-setuptools-git

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-shutil?expand=0&rev=28
This commit is contained in:
Daniel Garcia 2024-11-04 11:05:56 +00:00 committed by Git OBS Bridge
commit 5aee9d9c26
8 changed files with 283 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View 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

BIN
pytest-shutil-1.7.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

BIN
pytest-shutil-1.8.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,76 @@
-------------------------------------------------------------------
Mon Nov 4 11:05:21 UTC 2024 - Daniel Garcia <daniel.garcia@suse.com>
- Remove not needed dep python-setuptools-git
-------------------------------------------------------------------
Tue Oct 22 06:08:51 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 1.8.0:
* Drop support for Python 2 and <3.6, removing compatibility code.
* Use stdlib unittest.mock instead of mock package.
* Removed usage of path.py and path in favour of pathlib.
* Removed contextlib2 requirement.
* Fixed forcing color through termcolor.
- Drop patches, included upstream:
* pytest-fixtures-pr171-remove-mock.patch
* stop-using-imp.patch
-------------------------------------------------------------------
Wed Jan 24 04:48:42 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch stop-using-imp.patch:
* Use importlib and not imp.
-------------------------------------------------------------------
Sat Jun 10 11:50:04 UTC 2023 - ecsos <ecsos@opensuse.org>
- Add %{?sle15_python_module_pythons}
-------------------------------------------------------------------
Mon Dec 5 11:16:10 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
- Disable test_pretty_formatter test that fails in osc build but it works when
run manually.
-------------------------------------------------------------------
Thu Apr 21 21:51:01 UTC 2022 - Ben Greiner <code@bnavigator.de>
- 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
-------------------------------------------------------------------
Wed Mar 23 06:45:41 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch remove-mock.patch:
* Do not use external mock.
-------------------------------------------------------------------
Fri Mar 13 12:37:42 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Build without python2 present
-------------------------------------------------------------------
Sat Dec 28 18:31:07 UTC 2019 - Ondřej Súkup <mimi.vx@gmail.com>
- fix python-path/python-path.py requires
-------------------------------------------------------------------
Mon Jun 3 09:07:17 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 1.7.0:
* Support pytest 4
-------------------------------------------------------------------
Fri Mar 22 07:23:42 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Remove dependency on contextlib2 on Python 3
-------------------------------------------------------------------
Wed Feb 20 11:52:07 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Initial commit, neded by pytest-virtualenv

69
python-pytest-shutil.spec Normal file
View File

@ -0,0 +1,69 @@
#
# spec file for package python-pytest-shutil
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
Name: python-pytest-shutil
Version: 1.8.0
Release: 0
Summary: A goodie-bag of unix shell and environment tools for pytest
License: MIT
URL: https://github.com/man-group/pytest-plugins
Source: https://files.pythonhosted.org/packages/source/p/pytest-shutil/pytest-shutil-%{version}.tar.gz
BuildRequires: %{python_module execnet}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six}
BuildRequires: %{python_module termcolor}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-execnet
Requires: python-pytest
Requires: python-six
Requires: python-termcolor
BuildArch: noarch
%python_subpackages
%description
This library is a goodie-bag of Unix shell and environment management
tools for automated tests.
%prep
%autosetup -p2 -n pytest-shutil-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
# Disable test_pretty_formatter test that fails in osc build but it works when
# run manually. It should be something related to the shell and termcolor
%pytest -k "not test_pretty_formatter"
%files %{python_files}
%doc README.md CHANGES.md
%license LICENSE
%{python_sitelib}/pytest_shutil
%{python_sitelib}/pytest_shutil-%{version}.dist-info
%changelog

36
stop-using-imp.patch Normal file
View File

@ -0,0 +1,36 @@
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):