forked from pool/python-pytest-profiling
Compare commits
4 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| c61b5046af | |||
| 0f7905baa3 | |||
| 1c5bf69f6a | |||
| ce3cb125c5 |
@@ -1,38 +0,0 @@
|
|||||||
From 5054ade74d72cdcc2096ecbde3355253894a43a0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Steve Kowalik <steven@wedontsleep.org>
|
|
||||||
Date: Tue, 12 Mar 2024 15:12:00 +1100
|
|
||||||
Subject: [PATCH] pytest-profiling: Fix mock in test_writes_summary
|
|
||||||
|
|
||||||
In Python < 3.12, MagicMock's will blindly call any method provided to
|
|
||||||
them, which is masking a real issue in this testcase. The correct method
|
|
||||||
is assert_called_with(), and even worse, one of the arguments provided
|
|
||||||
isn't correct either. Correct the method call, and provide the correct
|
|
||||||
argument.
|
|
||||||
---
|
|
||||||
pytest-profiling/tests/unit/test_profile.py | 5 ++++-
|
|
||||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
Index: pytest-profiling-1.7.0/tests/unit/test_profile.py
|
|
||||||
===================================================================
|
|
||||||
--- pytest-profiling-1.7.0.orig/tests/unit/test_profile.py
|
|
||||||
+++ pytest-profiling-1.7.0/tests/unit/test_profile.py
|
|
||||||
@@ -2,6 +2,7 @@
|
|
||||||
# the top-level code in pytest_profiling will be omitted from
|
|
||||||
# coverage, so force it to be reloaded within this test unit under coverage
|
|
||||||
|
|
||||||
+import os.path
|
|
||||||
from importlib import reload # @UnresolvedImport
|
|
||||||
|
|
||||||
import pytest_profiling
|
|
||||||
@@ -49,8 +50,10 @@ def test_writes_summary():
|
|
||||||
with patch('pstats.Stats', return_value=stats) as Stats:
|
|
||||||
plugin.pytest_sessionfinish(Mock(), Mock())
|
|
||||||
plugin.pytest_terminal_summary(terminalreporter)
|
|
||||||
+ combined = os.path.abspath(
|
|
||||||
+ os.path.join(os.path.curdir, "prof", "combined.prof"))
|
|
||||||
assert 'Profiling' in terminalreporter.write.call_args[0][0]
|
|
||||||
- assert Stats.called_with(stats, stream=terminalreporter)
|
|
||||||
+ Stats.assert_called_with(combined, stream=terminalreporter)
|
|
||||||
|
|
||||||
|
|
||||||
def test_writes_summary_svg():
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
diff --git a/pytest-profiling/tests/unit/test_profile.py b/pytest-profiling/tests/unit/test_profile.py
|
|
||||||
index 616c4c6..614422e 100644
|
|
||||||
--- a/tests/unit/test_profile.py
|
|
||||||
+++ b/tests/unit/test_profile.py
|
|
||||||
@@ -8,7 +8,12 @@
|
|
||||||
reload_module(pytest_profiling)
|
|
||||||
|
|
||||||
from pytest_profiling import Profiling, pytest_addoption, pytest_configure
|
|
||||||
-from mock import Mock, ANY, patch, sentinel
|
|
||||||
+
|
|
||||||
+try:
|
|
||||||
+ from unittest.mock import Mock, ANY, patch, sentinel
|
|
||||||
+except ImportError:
|
|
||||||
+ # python 2
|
|
||||||
+ from mock import Mock, ANY, patch, sentinel
|
|
||||||
|
|
||||||
|
|
||||||
def test_creates_prof_dir():
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:93938f147662225d2b8bd5af89587b979652426a8a6ffd7e73ec4a23e24b7f29
|
|
||||||
size 30985
|
|
||||||
3
pytest-profiling-1.8.1.tar.gz
Normal file
3
pytest-profiling-1.8.1.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:3f171fa69d5c82fa9aab76d66abd5f59da69135c37d6ae5bf7557f1b154cb08d
|
||||||
|
size 33135
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
Index: pytest-profiling-1.7.0/pytest_profiling.py
|
Index: pytest-profiling-1.8.1/pytest_profiling.py
|
||||||
===================================================================
|
===================================================================
|
||||||
--- pytest-profiling-1.7.0.orig/pytest_profiling.py
|
--- pytest-profiling-1.8.1.orig/pytest_profiling.py
|
||||||
+++ pytest-profiling-1.7.0/pytest_profiling.py
|
+++ pytest-profiling-1.8.1/pytest_profiling.py
|
||||||
@@ -10,7 +10,6 @@ import pipes
|
@@ -10,7 +10,6 @@ import errno
|
||||||
import errno
|
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
|
import subprocess
|
||||||
|
|
||||||
-import six
|
-import six
|
||||||
import pytest
|
import pytest
|
||||||
@@ -13,35 +13,36 @@ Index: pytest-profiling-1.7.0/pytest_profiling.py
|
|||||||
@@ -18,7 +17,7 @@ LARGE_FILENAME_HASH_LEN = 8
|
@@ -18,7 +17,7 @@ LARGE_FILENAME_HASH_LEN = 8
|
||||||
|
|
||||||
def clean_filename(s):
|
def clean_filename(s):
|
||||||
forbidden_chars = set('/?<>\:*|"')
|
forbidden_chars = set(r'/?<>\:*|"')
|
||||||
- return six.text_type("".join(c if c not in forbidden_chars and ord(c) < 127 else '_'
|
- return six.text_type("".join(c if c not in forbidden_chars and ord(c) < 127 else '_'
|
||||||
+ return str("".join(c if c not in forbidden_chars and ord(c) < 127 else '_'
|
+ return str("".join(c if c not in forbidden_chars and ord(c) < 127 else '_'
|
||||||
for c in s))
|
for c in s))
|
||||||
|
|
||||||
|
|
||||||
Index: pytest-profiling-1.7.0/tests/unit/test_profile.py
|
Index: pytest-profiling-1.8.1/tests/unit/test_profile.py
|
||||||
===================================================================
|
===================================================================
|
||||||
--- pytest-profiling-1.7.0.orig/tests/unit/test_profile.py
|
--- pytest-profiling-1.8.1.orig/tests/unit/test_profile.py
|
||||||
+++ pytest-profiling-1.7.0/tests/unit/test_profile.py
|
+++ pytest-profiling-1.8.1/tests/unit/test_profile.py
|
||||||
@@ -2,10 +2,10 @@
|
@@ -3,11 +3,11 @@
|
||||||
# the top-level code in pytest_profiling will be omitted from
|
|
||||||
# coverage, so force it to be reloaded within this test unit under coverage
|
# coverage, so force it to be reloaded within this test unit under coverage
|
||||||
|
|
||||||
|
import os.path
|
||||||
-from six.moves import reload_module # @UnresolvedImport
|
-from six.moves import reload_module # @UnresolvedImport
|
||||||
+from importlib import reload # @UnresolvedImport
|
+from importlib import reload
|
||||||
|
|
||||||
import pytest_profiling
|
import pytest_profiling
|
||||||
|
|
||||||
-reload_module(pytest_profiling)
|
-reload_module(pytest_profiling)
|
||||||
+reload(pytest_profiling)
|
+reload(pytest_profiling)
|
||||||
|
|
||||||
from pytest_profiling import Profiling, pytest_addoption, pytest_configure
|
import os
|
||||||
|
import subprocess
|
||||||
Index: pytest-profiling-1.7.0/setup.py
|
Index: pytest-profiling-1.8.1/setup.py
|
||||||
===================================================================
|
===================================================================
|
||||||
--- pytest-profiling-1.7.0.orig/setup.py
|
--- pytest-profiling-1.8.1.orig/setup.py
|
||||||
+++ pytest-profiling-1.7.0/setup.py
|
+++ pytest-profiling-1.8.1/setup.py
|
||||||
@@ -22,8 +22,7 @@ classifiers = [
|
@@ -24,8 +24,7 @@ classifiers = [
|
||||||
'Programming Language :: Python :: 3.7',
|
'Programming Language :: Python :: 3.12',
|
||||||
]
|
]
|
||||||
|
|
||||||
-install_requires = ['six',
|
-install_requires = ['six',
|
||||||
|
|||||||
@@ -1,3 +1,32 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Feb 4 04:06:12 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Update to 1.8.1:
|
||||||
|
* Small refactor to make error messages a bit clearer
|
||||||
|
* Fixed tests which were installing from PyPI rather than local
|
||||||
|
* Removed usage of deprecated pytest.yield_fixture.
|
||||||
|
* Removed usage of distutils, where possible.
|
||||||
|
- Refreshed python-pytest-profiling-no-six.patch
|
||||||
|
- Drop patch fix-type-arguments.patch, now included.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
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.
|
||||||
|
* Added support to hide/show the full path of file.
|
||||||
|
* Remove pinning of more-itertools.
|
||||||
|
* Add support to define element number for print_stats()
|
||||||
|
* Fix mock in test_writes_summary
|
||||||
|
- Dropped patches, included upstream:
|
||||||
|
* pytest-fixtures-pr171-remove-mock.patch
|
||||||
|
* fix-mock-call.patch
|
||||||
|
- Add patch fix-type-arguments.patch:
|
||||||
|
* Use correct type argument for argparse.
|
||||||
|
- Refreshed python-pytest-profiling-no-six.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Mar 12 04:30:03 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
Tue Mar 12 04:30:03 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-pytest-profiling
|
# spec file for package python-pytest-profiling
|
||||||
#
|
#
|
||||||
# Copyright (c) 2024 SUSE LLC
|
# Copyright (c) 2025 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@@ -17,18 +17,14 @@
|
|||||||
|
|
||||||
|
|
||||||
Name: python-pytest-profiling
|
Name: python-pytest-profiling
|
||||||
Version: 1.7.0
|
Version: 1.8.1
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Profiling plugin for pytest
|
Summary: Profiling plugin for pytest
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/manahl/pytest-plugins
|
URL: https://github.com/man-group/pytest-plugins
|
||||||
Source: https://files.pythonhosted.org/packages/source/p/pytest-profiling/pytest-profiling-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/p/pytest-profiling/pytest-profiling-%{version}.tar.gz
|
||||||
# PATCH-FEATURE-UPSTREAM pytest-fixtures-pr171-remove-mock.patch -- gh#man-group#pytest-plugins#171
|
|
||||||
Patch0: pytest-fixtures-pr171-remove-mock.patch
|
|
||||||
# https://github.com/man-group/pytest-plugins/issues/209
|
# https://github.com/man-group/pytest-plugins/issues/209
|
||||||
Patch1: python-pytest-profiling-no-six.patch
|
Patch0: python-pytest-profiling-no-six.patch
|
||||||
# PATCH-FIX-UPSTREAM Based on gh#man-group/pytest-plugins#223
|
|
||||||
Patch2: fix-mock-call.patch
|
|
||||||
BuildRequires: %{python_module pip}
|
BuildRequires: %{python_module pip}
|
||||||
BuildRequires: %{python_module setuptools-git}
|
BuildRequires: %{python_module setuptools-git}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
@@ -47,12 +43,10 @@ BuildRequires: %{python_module pytest}
|
|||||||
%python_subpackages
|
%python_subpackages
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Profiling plugin for py.test
|
Profiling plugin for pytest
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -p1 -n pytest-profiling-%{version}
|
%autosetup -p1 -n pytest-profiling-%{version}
|
||||||
# Unpin
|
|
||||||
sed -i 's/more-itertools==5.0.0/more-itertools/' tests/integration/test_profile_integration.py
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%pyproject_wheel
|
%pyproject_wheel
|
||||||
|
|||||||
Reference in New Issue
Block a user