1
0

Accepting request 1191165 from home:mcalabkova:branches:devel:languages:python

- Update to 6.108.5
  * The alphabet= argument to from_regex() now accepts unions of characters() 
    and sampled_from() strategies, in addition to accepting each individually.
  * Improves support for unions of numpy dtypes such as np.float64 | np.complex128 
    in from_type() and arrays()
  * Support for Django 5.0, drop support for end-of-life Django versions (< 4.2).
  * Migrate the shrinker to our new internal representation, called the IR layer.
    This improves the shrinker’s performance in the majority of cases. For example, 
    on the Hypothesis test suite, shrinking is a median of 1.38x faster.
  * The from_dtype() function no longer generates NaT (“not-a-time”) values for the 
    datetime64 or timedelta64 dtypes if passed allow_nan=False
  * Add the experimental and unstable backend setting. See documentation for details.
  * Many more minor changes, see the upstream changelog.
- Add 0001-Revert-Use-tmp_path-in-ghostwriter-tests.patch to fix tests
  * https://github.com/HypothesisWorks/hypothesis/issues/4062

OBS-URL: https://build.opensuse.org/request/show/1191165
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-hypothesis?expand=0&rev=191
This commit is contained in:
Matej Cepl 2024-08-02 15:49:41 +00:00 committed by Git OBS Bridge
commit 26f5c201a1
9 changed files with 4080 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,88 @@
From c83493953839da2d0ae06c094984e7a90af215dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mark=C3=A9ta?= <meggy.calabkova@gmail.com>
Date: Fri, 2 Aug 2024 11:53:29 +0200
Subject: [PATCH] Revert "Use tmp_path in ghostwriter tests"
This reverts commit 769f5750b6bdbdccfd8b8b34c5f9b72196744421.
---
.../tests/ghostwriter/test_ghostwriter.py | 36 ++++++++-----------
1 file changed, 14 insertions(+), 22 deletions(-)
diff --git a/tests/ghostwriter/test_ghostwriter.py b/tests/ghostwriter/test_ghostwriter.py
index ddee5e78f..7bad9f081 100644
--- a/tests/ghostwriter/test_ghostwriter.py
+++ b/tests/ghostwriter/test_ghostwriter.py
@@ -11,7 +11,6 @@
import ast
import enum
import json
-import os
import platform
import re
import socket
@@ -452,22 +451,13 @@ def test_get_imports_for_strategy(strategy, imports):
@pytest.fixture
-def in_temp_path(tmp_path):
- """Fixture to execute tests in a temporary path."""
- old_path = Path.cwd()
- os.chdir(tmp_path)
- yield
- os.chdir(old_path)
-
-
-@pytest.fixture
-def temp_script_file(in_temp_path):
- """Fixture to create a script file in a temporary working directory.
-
- Changes the working directory to a temporary directory, then yields an extant file
- whose name will end in .py and which includes an importable function.
+def temp_script_file():
+ """Fixture to yield a Path to a temporary file in the local directory. File name will end
+ in .py and will include an importable function.
"""
p = Path("my_temp_script.py")
+ if p.exists():
+ raise FileExistsError(f"Did not expect {p} to exist during testing")
p.write_text(
dedent(
"""
@@ -477,17 +467,18 @@ def temp_script_file(in_temp_path):
),
encoding="utf-8",
)
- return p
+ yield p
+ p.unlink()
@pytest.fixture
-def temp_script_file_with_py_function(in_temp_path):
- """Fixture to create a python file in a temporary working directory.
-
- Changes the working directory to a temporary directory, then yields an extant file
- whose name will end in .py and which includes an importable function named "py".
+def temp_script_file_with_py_function():
+ """Fixture to yield a Path to a temporary file in the local directory. File name will end
+ in .py and will include an importable function named "py"
"""
p = Path("my_temp_script_with_py_function.py")
+ if p.exists():
+ raise FileExistsError(f"Did not expect {p} to exist during testing")
p.write_text(
dedent(
"""
@@ -497,7 +488,8 @@ def temp_script_file_with_py_function(in_temp_path):
),
encoding="utf-8",
)
- return p
+ yield p
+ p.unlink()
def test_obj_name(temp_script_file, temp_script_file_with_py_function):
--
2.45.2

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>test</package>
</multibuild>

16
_service Normal file
View File

@ -0,0 +1,16 @@
<services>
<service name="tar_scm" mode="manual">
<param name="url">https://github.com/HypothesisWorks/hypothesis.git</param>
<param name="scm">git</param>
<param name="revision">hypothesis-python-6.108.5</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">hypothesis-python-(.*)</param>
<param name="subdir">hypothesis-python</param>
<param name="filename">hypothesis-python</param>
</service>
<service name="recompress" mode="manual">
<param name="file">*.tar</param>
<param name="compression">gz</param>
</service>
<service name="set_version" mode="manual" />
</services>

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c51df375a0df8e83a525dc768dba398435900d483f8cd605573c6af382550868
size 930584

BIN
hypothesis-python-6.98.9.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

3718
python-hypothesis.changes Normal file

File diff suppressed because it is too large Load Diff

225
python-hypothesis.spec Normal file
View File

@ -0,0 +1,225 @@
#
# spec file for package python-hypothesis
#
# 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/
#
%global flavor @BUILD_FLAVOR@%{nil}
# Without complete tests for SLES to avoid python-pandas requirement
%if 0%{?suse_version} <= 1600
%bcond_with complete_tests
%else
%bcond_without complete_tests
%endif
%bcond_with ringdisabled
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
# Magic for OBS Staging. Only build the flavors required by
# other packages in the ring.
%if %{with ringdisabled}
ExclusiveArch: do_not_build
%endif
%else
%define psuffix %{nil}
%bcond_with test
%endif
%{?sle15_python_module_pythons}
Name: python-hypothesis%{psuffix}
Version: 6.108.5
Release: 0
Summary: A library for property based testing
License: MPL-2.0
URL: https://github.com/HypothesisWorks/hypothesis
# Source is the `hypothesis-python` subdir of the Github repository.
# Edit the `_service` file and run `osc service manualrun` for updates.
# See also https://hypothesis.readthedocs.io/en/latest/packaging.html
Source: hypothesis-python-%{version}.tar.gz
# PATCH-FIX-UPSTREAM revert of https://github.com/HypothesisWorks/hypothesis/commit/769f5750b6bdbdccfd8b8b34c5f9b72196744421
# gh#HypothesisWorks/hypothesis#4062
Patch: 0001-Revert-Use-tmp_path-in-ghostwriter-tests.patch
BuildRequires: %{python_module base >= 3.8}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytz}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-attrs >= 19.2.0
Requires: (python-exceptiongroup >= 1.0.0 if python-base < 3.11)
Requires: (python-sortedcontainers >= 2.1.0 with python-sortedcontainers < 3.0)
Requires(post): update-alternatives
Requires(preun): update-alternatives
BuildArch: noarch
# SECTION requires_extra
Recommends: (python-importlib_metadata >= 3.6 if python-base < 3.8)
# consuming packages need to declare these optional dependencies explicitly
Recommends: python-Django >= 3.2
Recommends: python-black >= 19.10
Recommends: python-click >= 7.0
Recommends: python-dpcontracts >= 0.4
Recommends: python-lark >= 0.10.1
Recommends: python-libcst >= 0.3.16
Recommends: python-numpy >= 1.16.0
Recommends: python-pandas >= 1.1
Recommends: python-pytest >= 4.6
Recommends: python-python-dateutil >= 1.4
Recommends: python-pytz >= 2014.1
Recommends: python-redis >= 3.0.0
Recommends: python-rich >= 9.0
# /SECTION
%if %{with test}
BuildRequires: %{python_module hypothesis = %{version}}
# SECTION test requirements
BuildRequires: %{python_module backports.zoneinfo >= 0.2.1 if %python-base < 3.9}
BuildRequires: %{python_module black >= 19.10}
BuildRequires: %{python_module click}
BuildRequires: %{python_module dpcontracts >= 0.4}
BuildRequires: %{python_module flaky}
BuildRequires: %{python_module lark >= 0.10.1}
BuildRequires: %{python_module libcst >= 0.3.16}
BuildRequires: %{python_module numpy >= 1.16.0}
BuildRequires: %{python_module pexpect}
BuildRequires: %{python_module pytest >= 4.6}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module python-dateutil >= 1.4}
BuildRequires: %{python_module typing_extensions}
%if %{with complete_tests}
BuildRequires: %{python_module Django >= 3.2}
BuildRequires: %{python_module fakeredis}
BuildRequires: %{python_module pandas >= 1.1}
%endif
# /SECTION
%endif
%python_subpackages
%description
Hypothesis is a family of testing libraries which let you write tests parametrized
by a source of examples. A Hypothesis implementation then generates simple and
comprehensible examples that make your tests fail. This simplifies writing your
tests and makes them more powerful at the same time, by letting software automate
the boring bits and do them to a higher standard than a human would, freeing you
to focus on the higher level test logic.
This sort of testing is often called "property-based testing", and the most widely
known implementation of the concept is the Haskell library QuickCheck, but
Hypothesis differs significantly from QuickCheck and is designed to fit idiomatically
and easily into existing styles of testing that you are used to, with absolutely no
familiarity with Haskell or functional programming needed.
%prep
%setup -q -n hypothesis-python-%{version}
%autopatch -p1
# gh#HypothesisWorks/hypothesis#2447: make sure arr==0.0 is an array on 32-bit
sed -i 's/assert (arr == 0.0)/assert np.asarray(arr == 0.0)/' tests/numpy/test_gen_data.py
%build
%if !%{with test}
%pyproject_wheel
%endif
%install
%if !%{with test}
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%python_clone -a %{buildroot}%{_bindir}/hypothesis
%endif
%post
%python_install_alternative hypothesis
%postun
%python_uninstall_alternative hypothesis
%check
%if %{with test}
# theses tests try to write into global python_sitelib
# https://github.com/HypothesisWorks/hypothesis/issues/2546
donttest="test_updating_the_file_include_new_shrinkers"
donttest+=" or test_can_learn_to_normalize_the_unnormalized"
# requires a git checkout
donttest+=" or test_observability"
# Fail because typing comparison
donttest+=" or test_ghostwriter_on_hypothesis"
if [ $(getconf LONG_BIT) -eq 32 ]; then
donttest+=" or test_gets_right_dtype_for_empty_indices"
fi
# https://github.com/HypothesisWorks/hypothesis/issues/3704
donttest+=" or (test_make_full_patch and covering)"
donttest+=" or test_overflowing_integers_are_deprecated"
# we're disabling the healthcheck below, obs is too flaky with it
donttest+=" or fails_health_check or slow_tests or on_healthcheck or a_health_check"
donttest+=" or test_statistics_with_events_and_target"
donttest+=" or test_self_ref_regression"
# flaky test
donttest+=" or test_has_string_of_max_length"
# adapted from pytest.ini in github repo toplevel dir (above hypothesis-python)
echo '[pytest]
addopts=
-rfE
--strict-markers
--tb=native
-p pytester
--runpytest=subprocess
--hypothesis-profile=obs
-v
-n auto
--durations-min=1.0
xfail_strict = False
filterwarnings =
# error <-- disabled for obs packaging
ignore::hypothesis.errors.NonInteractiveExampleWarning
# https://github.com/pandas-dev/pandas/issues/41199
default:Creating a LegacyVersion has been deprecated and will be removed in the next major release:DeprecationWarning
default:distutils Version classes are deprecated\. Use packaging\.version instead:DeprecationWarning
# https://github.com/pandas-dev/pandas/issues/32056 (?)
default:numpy\.ufunc size changed, may indicate binary incompatibility\. Expected 216 from C header, got 232 from PyObject:RuntimeWarning
# https://github.com/pandas-dev/pandas/issues/34848
default:`np\.bool` is a deprecated alias for the builtin `bool`:DeprecationWarning
default:`np\.complex` is a deprecated alias for the builtin `complex`:DeprecationWarning
default:`np\.object` is a deprecated alias for the builtin `object`:DeprecationWarning
' > pytest.ini
# increase test deadline for slow obs executions
echo "
import hypothesis
hypothesis.settings.register_profile(
'obs',
deadline=5000,
suppress_health_check=[
hypothesis.HealthCheck.too_slow,
]
)
" >> tests/conftest.py
%if %{without complete_tests}
export PYTEST_ADDOPTS="--ignore=tests/pandas/ --ignore=tests/redis/test_redis_exampledatabase.py"
%endif
%pytest -c pytest.ini -k "not ($donttest)" tests; rm -rf .pytest_cache
%endif
%if !%{with test}
%files %{python_files}
%license LICENSE.txt
%doc README.rst
%python_alternative %{_bindir}/hypothesis
%{python_sitelib}/hypothesis
%{python_sitelib}/_hypothesis*.py
%{python_sitelib}/hypothesis-%{version}.dist-info
%pycache_only %{python_sitelib}/__pycache__/*hypothesis*
%endif
%changelog