17
0
Files
python-time-machine/python-time-machine.spec
Dirk Mueller 1229b178cd - update to 3.2.0:
* Add :attr:`time_machine.naive_mode` to control how time-
    machine interprets naive datetimes. The default mode is
    MIXED, which preserves existing behaviour: naive datetime
    objects and date objects are interpreted as UTC, while naive
    datetime strings are interpreted as local time. Three
    alternative modes are available:  UTC: naive datetimes are
    always interpreted as UTC. LOCAL: naive datetimes are
    interpreted as local time, matching Python's default
    semantics, and freezegun. ERROR: naive datetimes raise a
    RuntimeError, ensuring your tests are isolated from the
    current timezone.   Note It’s recommended you use LOCAL or
    ERROR to avoid confusion around naive datetimes.  PR #591.
    Thanks to Paolo Melchiorre for review. Thanks to PhML,
    Stefaan Lippens, Matthieu Rigal, Nikita Demir, Steve Mavens,
    Andy Freeland, and Paul Ganssle for their input on Issue
    #257.
  * UTC: naive datetimes are always interpreted as UTC.
  * LOCAL: naive datetimes are interpreted as local time,
    matching Python's default semantics, and freezegun.
  * ERROR: naive datetimes raise a RuntimeError, ensuring your
    tests are isolated from the current timezone.
  * Raise RuntimeError when attempting to start time travelling
    if freezegun is active. This change should help avoid
    surprises when migrating complex test suites from freezegun
    to time-machine. PR #590.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-time-machine?expand=0&rev=39
2026-01-28 12:28:09 +00:00

73 lines
2.4 KiB
RPMSpec

#
# spec file for package python-time-machine
#
# Copyright (c) 2026 SUSE LLC and contributors
#
# 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/
#
Name: python-time-machine
Version: 3.2.0
Release: 0
Summary: Travel through time in your tests
License: MIT
Group: Development/Languages/Python
URL: https://github.com/adamchainz/time-machine
# pypi packages don't contain the tests anymore since 2.2.0, see changelog
Source: https://github.com/adamchainz/time-machine/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires: %{python_module devel >= 3.8}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-generators
BuildRequires: python-rpm-macros
Requires: python-python-dateutil
Requires: python-tokenize-rt
Requires: timezone
# SECTION tests
BuildRequires: %{python_module backports.zoneinfo if %python-base < 3.9}
BuildRequires: %{python_module freezegun}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module python-dateutil}
BuildRequires: %{python_module tokenize-rt}
BuildRequires: timezone
# /SECTION
%python_subpackages
%description
This library mocks all functions from Python's standard library that return the current date or datetime.
It can be used independently, as a function decorator, or as a context manager.
%prep
%setup -q -n time-machine-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%check
%pytest_arch
%files %{python_files}
%doc README.rst HISTORY.rst
%license LICENSE
%{python_sitearch}/time_machine
%{python_sitearch}/_time_machine.*.so
%{python_sitearch}/time_machine-%{version}*-info
%changelog