openSUSE Commits
Threads by month
- ----- 2024 -----
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
November 2022
- 1 participants
- 2423 discussions
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-marshmallow for openSUSE:Factory checked in at 2022-11-01 13:42:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-marshmallow (Old)
and /work/SRC/openSUSE:Factory/.python-marshmallow.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-marshmallow"
Tue Nov 1 13:42:18 2022 rev:18 rq:1032503 version:3.18.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-marshmallow/python-marshmallow.changes 2022-09-30 17:58:05.401286521 +0200
+++ /work/SRC/openSUSE:Factory/.python-marshmallow.new.2275/python-marshmallow.changes 2022-11-01 13:42:29.399871111 +0100
@@ -2 +2 @@
-Thu Sep 29 15:53:34 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam(a)suse.com>
+Fri Oct 28 18:21:19 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam(a)suse.com>
@@ -8,0 +9,3 @@
+
+-------------------------------------------------------------------
+Thu Sep 29 15:53:34 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam(a)suse.com>
Old:
----
marshmallow-3.17.1.tar.gz
New:
----
marshmallow-3.18.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-marshmallow.spec ++++++
--- /var/tmp/diff_new_pack.GQCtsu/_old 2022-11-01 13:42:29.799873240 +0100
+++ /var/tmp/diff_new_pack.GQCtsu/_new 2022-11-01 13:42:29.807873282 +0100
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-marshmallow
-Version: 3.17.1
+Version: 3.18.0
Release: 0
Summary: ORM/ODM/framework-agnostic library to convert datatypes from/to Python types
License: BSD-3-Clause AND MIT
++++++ marshmallow-3.17.1.tar.gz -> marshmallow-3.18.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/marshmallow-3.17.1/CHANGELOG.rst new/marshmallow-3.18.0/CHANGELOG.rst
--- old/marshmallow-3.17.1/CHANGELOG.rst 2022-08-22 21:36:43.000000000 +0200
+++ new/marshmallow-3.18.0/CHANGELOG.rst 2022-09-15 22:26:57.000000000 +0200
@@ -1,12 +1,23 @@
Changelog
---------
+3.18.0 (2022-09-15)
+*******************
+
+Features:
+
+- Add ``Enum`` field (:pr:`2017`) and (:pr:`2044`).
+
+Bug fixes:
+
+- Fix typing in ``Field._serialize`` signature (:pr:`2046`).
+
3.17.1 (2022-08-22)
*******************
Bug fixes:
-- Add return type to `fields.Email.__init__` (:pr:`2018`).
+- Add return type to ``fields.Email.__init__`` (:pr:`2018`).
Thanks :user:`kkirsche` for the PR.
- Add missing type hint to IPInterface __init__ (:pr:`2036`).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/marshmallow-3.17.1/PKG-INFO new/marshmallow-3.18.0/PKG-INFO
--- old/marshmallow-3.17.1/PKG-INFO 2022-08-22 21:36:55.306264200 +0200
+++ new/marshmallow-3.18.0/PKG-INFO 2022-09-15 22:27:10.895295400 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: marshmallow
-Version: 3.17.1
+Version: 3.18.0
Summary: A lightweight library for converting complex datatypes to and from native Python datatypes.
Home-page: https://github.com/marshmallow-code/marshmallow
Author: Steven Loria
@@ -173,12 +173,6 @@
:target: https://tidelift.com/subscription/pkg/pypi-marshmallow?utm_source=pypi-mars…
:alt: Get supported marshmallow with Tidelift
-Security Contact Information
-============================
-
-To report a security vulnerability, please use the
-`Tidelift security contact <https://tidelift.com/security>`_.
-Tidelift will coordinate the fix and disclosure.
Project Links
=============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/marshmallow-3.17.1/README.rst new/marshmallow-3.18.0/README.rst
--- old/marshmallow-3.17.1/README.rst 2022-08-22 21:36:43.000000000 +0200
+++ new/marshmallow-3.18.0/README.rst 2022-09-15 22:26:57.000000000 +0200
@@ -145,12 +145,6 @@
:target: https://tidelift.com/subscription/pkg/pypi-marshmallow?utm_source=pypi-mars…
:alt: Get supported marshmallow with Tidelift
-Security Contact Information
-============================
-
-To report a security vulnerability, please use the
-`Tidelift security contact <https://tidelift.com/security>`_.
-Tidelift will coordinate the fix and disclosure.
Project Links
=============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/marshmallow-3.17.1/setup.py new/marshmallow-3.18.0/setup.py
--- old/marshmallow-3.17.1/setup.py 2022-08-22 21:36:43.000000000 +0200
+++ new/marshmallow-3.18.0/setup.py 2022-09-15 22:26:57.000000000 +0200
@@ -6,7 +6,7 @@
"lint": [
"mypy==0.971",
"flake8==5.0.4",
- "flake8-bugbear==22.8.22",
+ "flake8-bugbear==22.9.11",
"pre-commit~=2.4",
],
"docs": [
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/marshmallow-3.17.1/src/marshmallow/__init__.py new/marshmallow-3.18.0/src/marshmallow/__init__.py
--- old/marshmallow-3.17.1/src/marshmallow/__init__.py 2022-08-22 21:36:43.000000000 +0200
+++ new/marshmallow-3.18.0/src/marshmallow/__init__.py 2022-09-15 22:26:57.000000000 +0200
@@ -16,7 +16,7 @@
from . import fields
-__version__ = "3.17.1"
+__version__ = "3.18.0"
__parsed_version__ = Version(__version__)
__version_info__: tuple[int, int, int] | tuple[
int, int, int, str, int
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/marshmallow-3.17.1/src/marshmallow/fields.py new/marshmallow-3.18.0/src/marshmallow/fields.py
--- old/marshmallow-3.17.1/src/marshmallow/fields.py 2022-08-22 21:36:43.000000000 +0200
+++ new/marshmallow-3.18.0/src/marshmallow/fields.py 2022-09-15 22:26:57.000000000 +0200
@@ -11,6 +11,7 @@
import math
import typing
import warnings
+from enum import Enum as EnumType
from collections.abc import Mapping as _Mapping
from marshmallow import validate, utils, class_registry, types
@@ -59,6 +60,7 @@
"IPInterface",
"IPv4Interface",
"IPv6Interface",
+ "Enum",
"Method",
"Function",
"Str",
@@ -384,7 +386,9 @@
self.parent.root if isinstance(self.parent, FieldABC) else self.parent
)
- def _serialize(self, value: typing.Any, attr: str, obj: typing.Any, **kwargs):
+ def _serialize(
+ self, value: typing.Any, attr: str | None, obj: typing.Any, **kwargs
+ ):
"""Serializes ``value`` to a basic Python datatype. Noop by default.
Concrete :class:`Field` classes should implement this method.
@@ -995,11 +999,7 @@
# override Number
def _validated(self, value):
- if self.strict:
- if isinstance(value, numbers.Number) and isinstance(
- value, numbers.Integral
- ):
- return super()._validated(value)
+ if self.strict and not isinstance(value, numbers.Integral):
raise self.make_error("invalid", input=value)
return super()._validated(value)
@@ -1855,6 +1855,79 @@
DESERIALIZATION_CLASS = ipaddress.IPv6Interface
+class Enum(Field):
+ """An Enum field (de)serializing enum members by symbol (name) or by value.
+
+ :param enum Enum: Enum class
+ :param boolean|Schema|Field by_value: Whether to (de)serialize by value or by name,
+ or Field class or instance to use to (de)serialize by value. Defaults to False.
+
+ If `by_value` is `False` (default), enum members are (de)serialized by symbol (name).
+ If it is `True`, they are (de)serialized by value using :class:`Field`.
+ If it is a field instance or class, they are (de)serialized by value using this field.
+
+ .. versionadded:: 3.18.0
+ """
+
+ default_error_messages = {
+ "unknown": "Must be one of: {choices}.",
+ }
+
+ def __init__(
+ self,
+ enum: type[EnumType],
+ *,
+ by_value: bool | Field | type = False,
+ **kwargs,
+ ):
+ super().__init__(**kwargs)
+ self.enum = enum
+ self.by_value = by_value
+
+ # Serialization by name
+ if by_value is False:
+ self.field: Field = String()
+ self.choices_text = ", ".join(
+ str(self.field._serialize(m, None, None)) for m in enum.__members__
+ )
+ # Serialization by value
+ else:
+ if by_value is True:
+ self.field = Field()
+ else:
+ try:
+ self.field = resolve_field_instance(by_value)
+ except FieldInstanceResolutionError as error:
+ raise ValueError(
+ '"by_value" must be either a bool or a subclass or instance of '
+ "marshmallow.base.FieldABC."
+ ) from error
+ self.choices_text = ", ".join(
+ str(self.field._serialize(m.value, None, None)) for m in enum
+ )
+
+ def _serialize(self, value, attr, obj, **kwargs):
+ if value is None:
+ return None
+ if self.by_value:
+ val = value.value
+ else:
+ val = value.name
+ return self.field._serialize(val, attr, obj, **kwargs)
+
+ def _deserialize(self, value, attr, data, **kwargs):
+ val = self.field._deserialize(value, attr, data, **kwargs)
+ if self.by_value:
+ try:
+ return self.enum(val)
+ except ValueError as error:
+ raise self.make_error("unknown", choices=self.choices_text) from error
+ try:
+ return getattr(self.enum, val)
+ except AttributeError as error:
+ raise self.make_error("unknown", choices=self.choices_text) from error
+
+
class Method(Field):
"""A field that takes the value returned by a `Schema` method.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/marshmallow-3.17.1/src/marshmallow.egg-info/PKG-INFO new/marshmallow-3.18.0/src/marshmallow.egg-info/PKG-INFO
--- old/marshmallow-3.17.1/src/marshmallow.egg-info/PKG-INFO 2022-08-22 21:36:55.000000000 +0200
+++ new/marshmallow-3.18.0/src/marshmallow.egg-info/PKG-INFO 2022-09-15 22:27:10.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: marshmallow
-Version: 3.17.1
+Version: 3.18.0
Summary: A lightweight library for converting complex datatypes to and from native Python datatypes.
Home-page: https://github.com/marshmallow-code/marshmallow
Author: Steven Loria
@@ -173,12 +173,6 @@
:target: https://tidelift.com/subscription/pkg/pypi-marshmallow?utm_source=pypi-mars…
:alt: Get supported marshmallow with Tidelift
-Security Contact Information
-============================
-
-To report a security vulnerability, please use the
-`Tidelift security contact <https://tidelift.com/security>`_.
-Tidelift will coordinate the fix and disclosure.
Project Links
=============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/marshmallow-3.17.1/src/marshmallow.egg-info/requires.txt new/marshmallow-3.18.0/src/marshmallow.egg-info/requires.txt
--- old/marshmallow-3.17.1/src/marshmallow.egg-info/requires.txt 2022-08-22 21:36:55.000000000 +0200
+++ new/marshmallow-3.18.0/src/marshmallow.egg-info/requires.txt 2022-09-15 22:27:10.000000000 +0200
@@ -6,7 +6,7 @@
simplejson
mypy==0.971
flake8==5.0.4
-flake8-bugbear==22.8.22
+flake8-bugbear==22.9.11
pre-commit~=2.4
tox
@@ -20,7 +20,7 @@
[lint]
mypy==0.971
flake8==5.0.4
-flake8-bugbear==22.8.22
+flake8-bugbear==22.9.11
pre-commit~=2.4
[tests]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/marshmallow-3.17.1/tests/base.py new/marshmallow-3.18.0/tests/base.py
--- old/marshmallow-3.17.1/tests/base.py 2022-08-22 21:36:43.000000000 +0200
+++ new/marshmallow-3.18.0/tests/base.py 2022-09-15 22:26:57.000000000 +0200
@@ -1,6 +1,8 @@
"""Test utilities and fixtures."""
+import functools
import datetime as dt
import uuid
+from enum import Enum, IntEnum
import simplejson
@@ -12,6 +14,25 @@
central = pytz.timezone("US/Central")
+class GenderEnum(IntEnum):
+ male = 1
+ female = 2
+ non_binary = 3
+
+
+class HairColorEnum(Enum):
+ black = "black hair"
+ brown = "brown hair"
+ blond = "blond hair"
+ red = "red hair"
+
+
+class DateEnum(Enum):
+ date_1 = dt.date(2004, 2, 29)
+ date_2 = dt.date(2008, 2, 29)
+ date_3 = dt.date(2012, 2, 29)
+
+
ALL_FIELDS = [
fields.String,
fields.Integer,
@@ -33,8 +54,12 @@
fields.IPInterface,
fields.IPv4Interface,
fields.IPv6Interface,
+ functools.partial(fields.Enum, GenderEnum),
+ functools.partial(fields.Enum, HairColorEnum, by_value=fields.String),
+ functools.partial(fields.Enum, GenderEnum, by_value=fields.Integer),
]
+
##### Custom asserts #####
@@ -69,7 +94,8 @@
birthdate=None,
birthtime=None,
balance=100,
- sex="male",
+ sex=GenderEnum.male,
+ hair_color=HairColorEnum.black,
employer=None,
various_data=None,
):
@@ -86,8 +112,8 @@
self.email = email
self.balance = balance
self.registered = registered
- self.hair_colors = ["black", "brown", "blond", "redhead"]
- self.sex_choices = ("male", "female")
+ self.hair_colors = list(HairColorEnum.__members__)
+ self.sex_choices = list(GenderEnum.__members__)
self.finger_count = 10
self.uid = uuid.uuid1()
self.time_registered = time_registered or dt.time(1, 23, 45, 6789)
@@ -95,6 +121,7 @@
self.birthtime = birthtime or dt.time(0, 1, 2, 3333)
self.activation_date = dt.date(2013, 12, 11)
self.sex = sex
+ self.hair_color = hair_color
self.employer = employer
self.relatives = []
self.various_data = various_data or {
@@ -180,7 +207,7 @@
birthtime = fields.Time()
activation_date = fields.Date()
since_created = fields.TimeDelta()
- sex = fields.Str(validate=validate.OneOf(["male", "female"]))
+ sex = fields.Str(validate=validate.OneOf(list(GenderEnum.__members__)))
various_data = fields.Dict()
class Meta:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/marshmallow-3.17.1/tests/test_deserialization.py new/marshmallow-3.18.0/tests/test_deserialization.py
--- old/marshmallow-3.17.1/tests/test_deserialization.py 2022-08-22 21:36:43.000000000 +0200
+++ new/marshmallow-3.18.0/tests/test_deserialization.py 2022-09-15 22:26:57.000000000 +0200
@@ -10,7 +10,15 @@
from marshmallow.exceptions import ValidationError
from marshmallow.validate import Equal
-from tests.base import assert_date_equal, assert_time_equal, central, ALL_FIELDS
+from tests.base import (
+ assert_date_equal,
+ assert_time_equal,
+ central,
+ ALL_FIELDS,
+ GenderEnum,
+ HairColorEnum,
+ DateEnum,
+)
class TestDeserializingNone:
@@ -1089,6 +1097,85 @@
assert excinfo.value.args[0] == "Not a valid IPv6 interface."
+ def test_enum_field_by_symbol_deserialization(self):
+ field = fields.Enum(GenderEnum)
+ assert field.deserialize("male") == GenderEnum.male
+
+ def test_enum_field_by_symbol_invalid_value(self):
+ field = fields.Enum(GenderEnum)
+ with pytest.raises(
+ ValidationError, match="Must be one of: male, female, non_binary."
+ ):
+ field.deserialize("dummy")
+
+ def test_enum_field_by_symbol_not_string(self):
+ field = fields.Enum(GenderEnum)
+ with pytest.raises(ValidationError, match="Not a valid string."):
+ field.deserialize(12)
+
+ def test_enum_field_by_value_true_deserialization(self):
+ field = fields.Enum(HairColorEnum, by_value=True)
+ assert field.deserialize("black hair") == HairColorEnum.black
+ field = fields.Enum(GenderEnum, by_value=True)
+ assert field.deserialize(1) == GenderEnum.male
+
+ def test_enum_field_by_value_field_deserialization(self):
+ field = fields.Enum(HairColorEnum, by_value=fields.String)
+ assert field.deserialize("black hair") == HairColorEnum.black
+ field = fields.Enum(GenderEnum, by_value=fields.Integer)
+ assert field.deserialize(1) == GenderEnum.male
+ field = fields.Enum(DateEnum, by_value=fields.Date(format="%d/%m/%Y"))
+ assert field.deserialize("29/02/2004") == DateEnum.date_1
+
+ def test_enum_field_by_value_true_invalid_value(self):
+ field = fields.Enum(HairColorEnum, by_value=True)
+ with pytest.raises(
+ ValidationError,
+ match="Must be one of: black hair, brown hair, blond hair, red hair.",
+ ):
+ field.deserialize("dummy")
+ field = fields.Enum(GenderEnum, by_value=True)
+ with pytest.raises(ValidationError, match="Must be one of: 1, 2, 3."):
+ field.deserialize(12)
+
+ def test_enum_field_by_value_field_invalid_value(self):
+ field = fields.Enum(HairColorEnum, by_value=fields.String)
+ with pytest.raises(
+ ValidationError,
+ match="Must be one of: black hair, brown hair, blond hair, red hair.",
+ ):
+ field.deserialize("dummy")
+ field = fields.Enum(GenderEnum, by_value=fields.Integer)
+ with pytest.raises(ValidationError, match="Must be one of: 1, 2, 3."):
+ field.deserialize(12)
+ field = fields.Enum(DateEnum, by_value=fields.Date(format="%d/%m/%Y"))
+ with pytest.raises(
+ ValidationError, match="Must be one of: 29/02/2004, 29/02/2008, 29/02/2012."
+ ):
+ field.deserialize("28/02/2004")
+
+ def test_enum_field_by_value_true_wrong_type(self):
+ field = fields.Enum(HairColorEnum, by_value=True)
+ with pytest.raises(
+ ValidationError,
+ match="Must be one of: black hair, brown hair, blond hair, red hair.",
+ ):
+ field.deserialize("dummy")
+ field = fields.Enum(GenderEnum, by_value=True)
+ with pytest.raises(ValidationError, match="Must be one of: 1, 2, 3."):
+ field.deserialize(12)
+
+ def test_enum_field_by_value_field_wrong_type(self):
+ field = fields.Enum(HairColorEnum, by_value=fields.String)
+ with pytest.raises(ValidationError, match="Not a valid string."):
+ field.deserialize(12)
+ field = fields.Enum(GenderEnum, by_value=fields.Integer)
+ with pytest.raises(ValidationError, match="Not a valid integer."):
+ field.deserialize("dummy")
+ field = fields.Enum(DateEnum, by_value=fields.Date(format="%d/%m/%Y"))
+ with pytest.raises(ValidationError, match="Not a valid date."):
+ field.deserialize("30/02/2004")
+
def test_deserialization_function_must_be_callable(self):
with pytest.raises(TypeError):
fields.Function(lambda x: None, deserialize="notvalid")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/marshmallow-3.17.1/tests/test_serialization.py new/marshmallow-3.18.0/tests/test_serialization.py
--- old/marshmallow-3.17.1/tests/test_serialization.py 2022-08-22 21:36:43.000000000 +0200
+++ new/marshmallow-3.18.0/tests/test_serialization.py 2022-09-15 22:26:57.000000000 +0200
@@ -11,7 +11,7 @@
from marshmallow import Schema, fields, missing as missing_
-from tests.base import User, ALL_FIELDS, central
+from tests.base import User, ALL_FIELDS, central, GenderEnum, HairColorEnum, DateEnum
class DateTimeList:
@@ -255,6 +255,31 @@
== ipv6interface_exploded_string
)
+ def test_enum_field_by_symbol_serialization(self, user):
+ user.sex = GenderEnum.male
+ field = fields.Enum(GenderEnum)
+ assert field.serialize("sex", user) == "male"
+
+ def test_enum_field_by_value_true_serialization(self, user):
+ user.hair_color = HairColorEnum.black
+ field = fields.Enum(HairColorEnum, by_value=True)
+ assert field.serialize("hair_color", user) == "black hair"
+ user.sex = GenderEnum.male
+ field = fields.Enum(GenderEnum, by_value=True)
+ assert field.serialize("sex", user) == 1
+ user.some_date = DateEnum.date_1
+
+ def test_enum_field_by_value_field_serialization(self, user):
+ user.hair_color = HairColorEnum.black
+ field = fields.Enum(HairColorEnum, by_value=fields.String)
+ assert field.serialize("hair_color", user) == "black hair"
+ user.sex = GenderEnum.male
+ field = fields.Enum(GenderEnum, by_value=fields.Integer)
+ assert field.serialize("sex", user) == 1
+ user.some_date = DateEnum.date_1
+ field = fields.Enum(DateEnum, by_value=fields.Date(format="%d/%m/%Y"))
+ assert field.serialize("some_date", user) == "29/02/2004"
+
def test_decimal_field(self, user):
user.m1 = 12
user.m2 = "12.355"
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-peewee for openSUSE:Factory checked in at 2022-11-01 13:42:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-peewee (Old)
and /work/SRC/openSUSE:Factory/.python-peewee.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-peewee"
Tue Nov 1 13:42:16 2022 rev:19 rq:1032500 version:3.15.3
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-peewee/python-peewee.changes 2022-10-08 01:25:56.434328128 +0200
+++ /work/SRC/openSUSE:Factory/.python-peewee.new.2275/python-peewee.changes 2022-11-01 13:42:27.827862749 +0100
@@ -2 +2 @@
-Tue Oct 4 22:59:19 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam(a)suse.com>
+Fri Oct 28 19:52:59 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam(a)suse.com>
@@ -9,0 +10,3 @@
+
+-------------------------------------------------------------------
+Tue Oct 4 22:59:19 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam(a)suse.com>
Old:
----
peewee-3.15.2.tar.gz
New:
----
peewee-3.15.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-peewee.spec ++++++
--- /var/tmp/diff_new_pack.y7hgnD/_old 2022-11-01 13:42:28.271865111 +0100
+++ /var/tmp/diff_new_pack.y7hgnD/_new 2022-11-01 13:42:28.275865132 +0100
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-peewee
-Version: 3.15.2
+Version: 3.15.3
Release: 0
Summary: An expressive ORM that supports multiple SQL backends
License: BSD-3-Clause
++++++ peewee-3.15.2.tar.gz -> peewee-3.15.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/peewee-3.15.2/CHANGELOG.md new/peewee-3.15.3/CHANGELOG.md
--- old/peewee-3.15.2/CHANGELOG.md 2022-08-26 16:08:15.000000000 +0200
+++ new/peewee-3.15.3/CHANGELOG.md 2022-09-22 04:55:53.000000000 +0200
@@ -7,7 +7,17 @@
## master
-[View commits](https://github.com/coleifer/peewee/compare/3.15.2...master)
+[View commits](https://github.com/coleifer/peewee/compare/3.15.3...master)
+
+## 3.15.3
+
+* Add `scalars()` query method (complements `scalar()`), roughly equivalent to
+ writing `[t[0] for t in query.tuples()]`.
+* Small doc improvements
+* Fix and remove some flaky test assertions with Sqlite INSERT + RETURNING.
+* Fix innocuous failing Sqlite test on big-endian machines.
+
+[View commits](https://github.com/coleifer/peewee/compare/3.15.2...3.15.3)
## 3.15.2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/peewee-3.15.2/docs/peewee/database.rst new/peewee-3.15.3/docs/peewee/database.rst
--- old/peewee-3.15.2/docs/peewee/database.rst 2022-08-26 16:08:15.000000000 +0200
+++ new/peewee-3.15.3/docs/peewee/database.rst 2022-09-22 04:55:53.000000000 +0200
@@ -101,8 +101,8 @@
Consult your database driver's documentation for the available parameters:
* Postgres: `psycopg2 <http://initd.org/psycopg/docs/module.html#psycopg2.connect>`_
-* MySQL: `MySQLdb <http://mysql-python.sourceforge.net/MySQLdb.html#some-mysql-examples>`_
* MySQL: `pymysql <https://github.com/PyMySQL/PyMySQL/blob/f08f01fe8a59e8acfb5f5add4a8fe874bec…>`_
+* MySQL: `mysqlclient <https://github.com/PyMySQL/mysqlclient>`_
* SQLite: `sqlite3 <https://docs.python.org/2/library/sqlite3.html#sqlite3.connect>`_
* CockroachDB: see `psycopg2 <http://initd.org/psycopg/docs/module.html#psycopg2.connect>`_
@@ -564,7 +564,7 @@
To connect to a MySQL database, we will use :py:class:`MySQLDatabase`. After
the database name, you can specify arbitrary connection parameters that will be
-passed back to the driver (either MySQLdb or pymysql).
+passed back to the driver (e.g. ``pymysql`` or ``mysqlclient``).
.. code-block:: python
@@ -579,6 +579,20 @@
username = CharField()
# etc, etc
+Driver information:
+
+* `pymysql <https://github.com/PyMySQL/PyMySQL>`_ is a pure-python mysql client,
+ works with python 2 and 3. Peewee will use attempt to use pymysql first.
+* `mysqlclient <https://github.com/PyMySQL/mysqlclient-python>`_ uses a c
+ extension and supports python 3. It exposes a ``MySQLdb`` module. Peewee will
+ attempt to use this module if pymysql is not installed.
+* ``mysql-python`` is also called `MySQLdb1 <https://github.com/farcepest/MySQLdb1>`_
+ and is legacy and should not be used. Since this shares the same module name
+ as mysqlclient, same applies.
+* `mysql-connector python <https://github.com/mysql/mysql-connector-python>`_ pure-python
+ (I think??) supports python 3. To use this driver you can use :ref:`MySQLConnectorDatabase`
+ from the ``playhouse.mysql_ext`` extension.
+
Error 2006: MySQL server has gone away
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/peewee-3.15.2/docs/peewee/playhouse.rst new/peewee-3.15.3/docs/peewee/playhouse.rst
--- old/peewee-3.15.2/docs/peewee/playhouse.rst 2022-08-26 16:08:15.000000000 +0200
+++ new/peewee-3.15.3/docs/peewee/playhouse.rst 2022-09-22 04:55:53.000000000 +0200
@@ -1603,31 +1603,41 @@
the `mariadb-connector <https://mariadb-corporation.github.io/mariadb-connector-python/>`_.
The implementations can be found in ``playhouse.mysql_ext``.
-Example usage of mysql-connector:
+.. py:class:: MySQLConnectorDatabase(database, **kwargs)
-.. code-block:: python
+ Database implementation using `mysql-connector <https://dev.mysql.com/doc/connector-python/en/>`_.
+ Full list of supported `connection parameters <https://dev.mysql.com/doc/connector-python/en/connector-python-connectargs.…>`_.
- from playhouse.mysql_ext import MySQLConnectorDatabase
+ Example usage of mysql-connector:
- # MySQL database implementation that utilizes mysql-connector driver.
- db = MySQLConnectorDatabase('my_database', host='1.2.3.4', user='mysql')
+ .. code-block:: python
-Example usage of mariadb-connector:
+ from playhouse.mysql_ext import MySQLConnectorDatabase
-.. code-block:: python
+ # MySQL database implementation that utilizes mysql-connector driver.
+ db = MySQLConnectorDatabase('my_database', host='1.2.3.4', user='mysql')
- from playhouse.mysql_ext import MariaDBConnectorDatabase
+.. py:class:: MariaDBConnectorDatabase(database, **kwargs)
- # MySQL database implementation that utilizes mysql-connector driver.
- db = MariaDBConnectorDatabase('my_database', host='1.2.3.4', user='mysql')
+ Database implementation using `mariadb-connector <https://mariadb-corporation.github.io/mariadb-connector-python/>`_.
+ Full list of supported `connection parameters <https://mariadb-corporation.github.io/mariadb-connector-python/module.html#…>`_.
-.. note::
- The :py:class:`MariaDBConnectorDatabase` does **not** accept the following
- parameters:
+ Example usage of mariadb-connector:
- * ``charset`` (it is always utf8mb4)
- * ``sql_mode``
- * ``use_unicode``
+ .. code-block:: python
+
+ from playhouse.mysql_ext import MariaDBConnectorDatabase
+
+ # MySQL database implementation that utilizes mysql-connector driver.
+ db = MariaDBConnectorDatabase('my_database', host='1.2.3.4', user='mysql')
+
+ .. note::
+ The :py:class:`MariaDBConnectorDatabase` does **not** accept the following
+ parameters:
+
+ * ``charset`` (it is always utf8mb4)
+ * ``sql_mode``
+ * ``use_unicode``
Additional MySQL-specific helpers:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/peewee-3.15.2/peewee.py new/peewee-3.15.3/peewee.py
--- old/peewee-3.15.2/peewee.py 2022-08-26 16:08:15.000000000 +0200
+++ new/peewee-3.15.3/peewee.py 2022-09-22 04:55:53.000000000 +0200
@@ -70,7 +70,7 @@
mysql = None
-__version__ = '3.15.2'
+__version__ = '3.15.3'
__all__ = [
'AnyField',
'AsIs',
@@ -1246,7 +1246,7 @@
'end-point.')
return self.between(item.start, item.stop)
return self == item
- def __iter__(self): raise NotImplementedError # Prevent accidents.
+ __iter__ = None # Prevent infinite loop.
def distinct(self):
return NodeList((SQL('DISTINCT'), self))
@@ -2212,6 +2212,11 @@
return row[0] if row and not as_tuple else row
@database_required
+ def scalars(self, database):
+ for row in self.tuples().execute(database):
+ yield row[0]
+
+ @database_required
def count(self, database, clear_limit=False):
clone = self.order_by().alias('_wrapped')
if clear_limit:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/peewee-3.15.2/setup.py new/peewee-3.15.3/setup.py
--- old/peewee-3.15.2/setup.py 2022-08-26 16:08:15.000000000 +0200
+++ new/peewee-3.15.3/setup.py 2022-09-22 04:55:53.000000000 +0200
@@ -162,10 +162,10 @@
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
- 'Programming Language :: Python :: 3.13',
- 'Programming Language :: Python :: 3.14',
- 'Programming Language :: Python :: 3.15',
- 'Programming Language :: Python :: 999.99',
+ #'Programming Language :: Python :: 3.13',
+ #'Programming Language :: Python :: 3.14',
+ #'Programming Language :: Python :: 3.15',
+ #'Programming Language :: Python :: 999.99',
'Topic :: Database',
'Topic :: Software Development :: Libraries :: Python Modules',
],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/peewee-3.15.2/tests/queries.py new/peewee-3.15.3/tests/queries.py
--- old/peewee-3.15.2/tests/queries.py 2022-08-26 16:08:15.000000000 +0200
+++ new/peewee-3.15.3/tests/queries.py 2022-09-22 04:55:53.000000000 +0200
@@ -116,6 +116,18 @@
query = query.where(Register.value >= 2)
self.assertEqual(query.scalar(as_tuple=True), (15, 3, 5))
+ def test_scalars(self):
+ values = [1.0, 1.5, 2.0, 5.0, 8.0]
+ (Register
+ .insert([{Register.value: value} for value in values])
+ .execute())
+
+ query = Register.select(Register.value).order_by(Register.value)
+ self.assertEqual(list(query.scalars()), values)
+
+ query = query.where(Register.value < 5)
+ self.assertEqual(list(query.scalars()), [1.0, 1.5, 2.0])
+
def test_slicing_select(self):
values = [1., 1., 2., 3., 5., 8.]
(Register
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/peewee-3.15.2/tests/regressions.py new/peewee-3.15.3/tests/regressions.py
--- old/peewee-3.15.2/tests/regressions.py 2022-08-26 16:08:15.000000000 +0200
+++ new/peewee-3.15.3/tests/regressions.py 2022-09-22 04:55:53.000000000 +0200
@@ -1740,4 +1740,4 @@
class TestFunctionInfiniteLoop(BaseTestCase):
def test_function_infinite_loop(self):
- self.assertRaises(NotImplementedError, lambda: list(fn.COUNT()))
+ self.assertRaises(TypeError, lambda: list(fn.COUNT()))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/peewee-3.15.2/tests/sqlite.py new/peewee-3.15.3/tests/sqlite.py
--- old/peewee-3.15.2/tests/sqlite.py 2022-08-26 16:08:15.000000000 +0200
+++ new/peewee-3.15.3/tests/sqlite.py 2022-09-22 04:55:53.000000000 +0200
@@ -1572,6 +1572,7 @@
cursor = self.database.execute(query)
self.assertEqual(cursor.fetchone()[0], e)
+ @skip_if(sys.byteorder == 'big', 'fails on big endian')
def test_murmur_hash(self):
self.assertHash('testkey', 2871421366)
self.assertHash('murmur', 3883399899)
@@ -2502,8 +2503,12 @@
iq = User.insert_many([{'username': 'u2'}, {'username': 'u3'}])
self.assertEqual(list(iq.execute()), [(2,), (3,)])
- iq = User.insert_many([('u4',), ('u5',)]).as_rowcount()
- self.assertEqual(iq.execute(), 2)
+ # NOTE: sqlite3_changes() does not return the inserted rowcount until
+ # the statement has been consumed. The fact that it returned 2 is a
+ # side-effect of the statement cache and our having consumed the query
+ # in the previous test assertion. So this test is invalid.
+ #iq = User.insert_many([('u4',), ('u5',)]).as_rowcount()
+ #self.assertEqual(iq.execute(), 2)
iq = KVR.insert({'key': 'k1', 'value': 1})
self.assertEqual(iq.execute(), 'k1')
@@ -2511,8 +2516,9 @@
iq = KVR.insert_many([('k2', 2), ('k3', 3)])
self.assertEqual(list(iq.execute()), [('k2',), ('k3',)])
- iq = KVR.insert_many([('k4', 4), ('k5', 5)]).as_rowcount()
- self.assertEqual(iq.execute(), 2)
+ # See note above.
+ #iq = KVR.insert_many([('k4', 4), ('k5', 5)]).as_rowcount()
+ #self.assertEqual(iq.execute(), 2)
def test_insert_on_conflict(self):
KVR.create(key='k1', value=1)
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-podman for openSUSE:Factory checked in at 2022-11-01 13:42:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-podman (Old)
and /work/SRC/openSUSE:Factory/.python-podman.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-podman"
Tue Nov 1 13:42:14 2022 rev:7 rq:1032499 version:4.3.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-podman/python-podman.changes 2022-08-16 17:07:52.755902422 +0200
+++ /work/SRC/openSUSE:Factory/.python-podman.new.2275/python-podman.changes 2022-11-01 13:42:24.779846534 +0100
@@ -1,0 +2,12 @@
+Fri Oct 28 19:54:33 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam(a)suse.com>
+
+- Update to 4.3.0
+ * Add pass-through layers, output and outputformat to building images
+ * Support passing of interval and condition in podman wait calls
+ * Implement podman image scp
+ * Update supported python versions
+ * Add support of passing empty strings in second
+ * Add support for on failure actions in healthchecks
+ * Bug fixes
+
+-------------------------------------------------------------------
Old:
----
podman-4.2.0.tar.gz
New:
----
podman-4.3.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-podman.spec ++++++
--- /var/tmp/diff_new_pack.Zc9KGL/_old 2022-11-01 13:42:27.523861132 +0100
+++ /var/tmp/diff_new_pack.Zc9KGL/_new 2022-11-01 13:42:27.531861175 +0100
@@ -27,7 +27,7 @@
%bcond_with test
%endif
Name: python-podman%{psuffix}
-Version: 4.2.0
+Version: 4.3.0
Release: 0
Summary: A library to interact with a Podman server
License: Apache-2.0
++++++ podman-4.2.0.tar.gz -> podman-4.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/podman-py-4.2.0/Makefile new/podman-py-4.3.0/Makefile
--- old/podman-py-4.2.0/Makefile 2022-08-10 15:03:52.000000000 +0200
+++ new/podman-py-4.3.0/Makefile 2022-10-19 23:32:04.000000000 +0200
@@ -8,7 +8,7 @@
EPOCH_TEST_COMMIT ?= $(shell git merge-base $${DEST_BRANCH:-main} HEAD)
HEAD ?= HEAD
-export PODMAN_VERSION ?= "4.2.0"
+export PODMAN_VERSION ?= "4.3.0"
.PHONY: podman
podman:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/podman-py-4.2.0/podman/api/http_utils.py new/podman-py-4.3.0/podman/api/http_utils.py
--- old/podman-py-4.2.0/podman/api/http_utils.py 2022-08-10 15:03:52.000000000 +0200
+++ new/podman-py-4.3.0/podman/api/http_utils.py 2022-10-19 23:32:04.000000000 +0200
@@ -66,26 +66,33 @@
return json.dumps(body, sort_keys=True)
-def _filter_values(mapping: Mapping[str, Any]) -> Dict[str, Any]:
+def _filter_values(mapping: Mapping[str, Any], recursion=False) -> Dict[str, Any]:
"""Returns a canonical dictionary with values == None or empty Iterables removed.
Dictionary is walked using recursion.
"""
canonical = {}
+
for key, value in mapping.items():
# quick filter if possible...
- if value is None or (isinstance(value, collections.abc.Sized) and len(value) <= 0):
+ if (
+ value is None
+ or (isinstance(value, collections.abc.Sized) and len(value) <= 0)
+ and not recursion
+ ):
continue
# depending on type we need details...
if isinstance(value, collections.abc.Mapping):
- proposal = _filter_values(value)
+ proposal = _filter_values(value, recursion=True)
elif isinstance(value, collections.abc.Iterable) and not isinstance(value, str):
proposal = [i for i in value if i is not None]
else:
proposal = value
- if proposal not in (None, str(), [], {}):
+ if not recursion and proposal not in (None, str(), [], {}):
+ canonical[key] = proposal
+ elif recursion and proposal not in (None, [], {}):
canonical[key] = proposal
return canonical
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/podman-py-4.2.0/podman/domain/containers.py new/podman-py-4.3.0/podman/domain/containers.py
--- old/podman-py-4.2.0/podman/domain/containers.py 2022-08-10 15:03:52.000000000 +0200
+++ new/podman-py-4.3.0/podman/domain/containers.py 2022-10-19 23:32:04.000000000 +0200
@@ -508,7 +508,7 @@
condition (Union[str, List[str]]): Container state on which to release.
One or more of: "configured", "created", "running", "stopped",
"paused", "exited", "removing", "stopping".
- timeout (int): Ignored.
+ interval (int): Time interval to wait before polling for completion.
Returns:
"Error" key has a dictionary value with the key "Message".
@@ -522,6 +522,13 @@
if isinstance(condition, str):
condition = [condition]
- response = self.client.post(f"/containers/{self.id}/wait", params={"condition": condition})
+ interval = kwargs.get("interval")
+
+ params = {}
+ if condition != []:
+ params["condition"] = condition
+ if interval != "":
+ params["interval"] = interval
+ response = self.client.post(f"/containers/{self.id}/wait", params=params)
response.raise_for_status()
return response.json()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/podman-py-4.2.0/podman/domain/containers_create.py new/podman-py-4.3.0/podman/domain/containers_create.py
--- old/podman-py-4.2.0/podman/domain/containers_create.py 2022-08-10 15:03:52.000000000 +0200
+++ new/podman-py-4.3.0/podman/domain/containers_create.py 2022-10-19 23:32:04.000000000 +0200
@@ -74,6 +74,7 @@
process will run as.
healthcheck (Dict[str,Any]): Specify a test to perform to check that the
container is healthy.
+ health_check_on_failure_action (int): Specify an action if a healthcheck fails.
hostname (str): Optional hostname for the container.
init (bool): Run an init inside the container that forwards signals and reaps processes
init_path (str): Path to the docker-init binary
@@ -371,6 +372,7 @@
"expose": {},
"groups": pop("group_add"),
"healthconfig": pop("healthcheck"),
+ "health_check_on_failure_action": pop("health_check_on_failure_action"),
"hostadd": [],
"hostname": pop("hostname"),
"httpproxy": pop("use_config_proxy"),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/podman-py-4.2.0/podman/domain/images_build.py new/podman-py-4.3.0/podman/domain/images_build.py
--- old/podman-py-4.2.0/podman/domain/images_build.py 2022-08-10 15:03:52.000000000 +0200
+++ new/podman-py-4.3.0/podman/domain/images_build.py 2022-10-19 23:32:04.000000000 +0200
@@ -61,6 +61,9 @@
isolation (str) ��� Isolation technology used during build. (ignored)
use_config_proxy (bool) ��� (ignored)
http_proxy (bool) - Inject http proxy environment variables into container (Podman only)
+ layers (bool) - Cache intermediate layers during build.
+ output (str) - specifies if any custom build output is selected for following build.
+ outputformat (str) - The format of the output image's manifest and configuration data.
Returns:
first item is the podman.domain.images.Image built
@@ -162,12 +165,15 @@
"squash": kwargs.get("squash"),
"t": kwargs.get("tag"),
"target": kwargs.get("target"),
+ "layers": kwargs.get("layers"),
+ "output": kwargs.get("output"),
+ "outputformat": kwargs.get("outputformat"),
}
if "buildargs" in kwargs:
params["buildargs"] = json.dumps(kwargs.get("buildargs"))
if "cache_from" in kwargs:
- params["cacheform"] = json.dumps(kwargs.get("cache_from"))
+ params["cachefrom"] = json.dumps(kwargs.get("cache_from"))
if "container_limits" in kwargs:
params["cpuperiod"] = kwargs["container_limits"].get("cpuperiod")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/podman-py-4.2.0/podman/domain/images_manager.py new/podman-py-4.3.0/podman/domain/images_manager.py
--- old/podman-py-4.2.0/podman/domain/images_manager.py 2022-08-10 15:03:52.000000000 +0200
+++ new/podman-py-4.3.0/podman/domain/images_manager.py 2022-10-19 23:32:04.000000000 +0200
@@ -391,3 +391,31 @@
response = self.client.get("/images/search", params=params)
response.raise_for_status(not_found=ImageNotFound)
return response.json()
+
+ def scp(
+ self,
+ source: str,
+ dest: Optional[str] = None,
+ quiet: Optional[bool] = False,
+ ) -> str:
+ """Securely copy images between hosts.
+
+ Args:
+ source: source connection/image
+ dest: destination connection/image
+ quiet: do not print save/load output, only the image
+
+ Returns:
+ A string containing the loaded image
+
+ Raises:
+ APIError: when service returns an error
+ """
+ params = {}
+ if dest is not None and quiet:
+ params = {"destination": dest, "quiet": quiet}
+ elif quiet:
+ params = {"quiet": quiet}
+ response = self.client.post(f"/images/scp/{source}", params=params)
+ response.raise_for_status()
+ return response.json()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/podman-py-4.2.0/podman/tests/__init__.py new/podman-py-4.3.0/podman/tests/__init__.py
--- old/podman-py-4.2.0/podman/tests/__init__.py 2022-08-10 15:03:52.000000000 +0200
+++ new/podman-py-4.3.0/podman/tests/__init__.py 2022-10-19 23:32:04.000000000 +0200
@@ -3,5 +3,5 @@
# Do not auto-update these from version.py,
# as test code should be changed to reflect changes in Podman API versions
BASE_SOCK = "unix:///run/api.sock"
-LIBPOD_URL = "http://%2Frun%2Fapi.sock/v4.2.0/libpod"
+LIBPOD_URL = "http://%2Frun%2Fapi.sock/v4.3.0/libpod"
COMPATIBLE_URL = "http://%2Frun%2Fapi.sock/v1.40"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/podman-py-4.2.0/podman/tests/integration/test_container_create.py new/podman-py-4.3.0/podman/tests/integration/test_container_create.py
--- old/podman-py-4.2.0/podman/tests/integration/test_container_create.py 2022-08-10 15:03:52.000000000 +0200
+++ new/podman-py-4.3.0/podman/tests/integration/test_container_create.py 2022-10-19 23:32:04.000000000 +0200
@@ -145,6 +145,14 @@
)
)
+ def test_container_healtchecks(self):
+ """Test passing various healthcheck options"""
+ parameters = {}
+ parameters['healthcheck'] = {'Test': ['CMD-SHELL curl http://localhost || exit']}
+ parameters['health_check_on_failure_action'] = 1
+ container = self.client.containers.create(self.alpine_image, **parameters)
+ self.containers.append(container)
+
def test_container_mem_limit(self):
"""Test passing memory limit"""
self._test_memory_limit('mem_limit', 'Memory')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/podman-py-4.2.0/podman/tests/integration/test_images.py new/podman-py-4.3.0/podman/tests/integration/test_images.py
--- old/podman-py-4.2.0/podman/tests/integration/test_images.py 2022-08-10 15:03:52.000000000 +0200
+++ new/podman-py-4.3.0/podman/tests/integration/test_images.py 2022-10-19 23:32:04.000000000 +0200
@@ -133,3 +133,15 @@
def test_pull_stream(self):
generator = self.client.images.pull("ubi8", tag="latest", stream=True)
self.assertIsInstance(generator, types.GeneratorType)
+
+ def test_scp(self):
+ with self.assertRaises(APIError) as e:
+ next(
+ self.client.images.scp(
+ source="randuser@fake.ip.addr:22::quay.io/libpod/alpine", quiet=False
+ )
+ )
+ self.assertIn(
+ "failed to connect: dial tcp: lookup fake.ip.addr: no such host",
+ e.exception.explanation,
+ )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/podman-py-4.2.0/podman/tests/unit/test_api_utils.py new/podman-py-4.3.0/podman/tests/unit/test_api_utils.py
--- old/podman-py-4.2.0/podman/tests/unit/test_api_utils.py 2022-08-10 15:03:52.000000000 +0200
+++ new/podman-py-4.3.0/podman/tests/unit/test_api_utils.py 2022-10-19 23:32:04.000000000 +0200
@@ -154,6 +154,16 @@
self.assertDictEqual(actual_dict["Dictionary"], payload["Dictionary"])
self.assertEqual(set(actual_dict["Set1"]), {"item1", "item2"})
+ def test_prepare_body_dict_empty_string(self):
+ payload = {"Dictionary": {"key1": "", "key2": {"key3": ""}, "key4": [], "key5": {}}}
+
+ actual = api.prepare_body(payload)
+ actual_dict = json.loads(actual)
+ payload["Dictionary"].pop("key4")
+ payload["Dictionary"].pop("key5")
+
+ self.assertDictEqual(payload, actual_dict)
+
if __name__ == '__main__':
unittest.main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/podman-py-4.2.0/podman/tests/unit/test_container.py new/podman-py-4.3.0/podman/tests/unit/test_container.py
--- old/podman-py-4.2.0/podman/tests/unit/test_container.py 2022-08-10 15:03:52.000000000 +0200
+++ new/podman-py-4.3.0/podman/tests/unit/test_container.py 2022-10-19 23:32:04.000000000 +0200
@@ -212,6 +212,18 @@
self.assertTrue(adapter.called_once)
@requests_mock.Mocker()
+ def test_wait_condition_interval(self, mock):
+ adapter = mock.post(
+ tests.LIBPOD_URL
+ + "/containers/87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/wait",
+ status_code=200,
+ json={"StatusCode": 0},
+ )
+ container = Container(attrs=FIRST_CONTAINER, client=self.client.api)
+ container.wait(condition="exited", interval=1)
+ self.assertTrue(adapter.called_once)
+
+ @requests_mock.Mocker()
def test_diff(self, mock):
payload = [
{"Path": "modified", "Kind": 0},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/podman-py-4.2.0/podman/version.py new/podman-py-4.3.0/podman/version.py
--- old/podman-py-4.2.0/podman/version.py 2022-08-10 15:03:52.000000000 +0200
+++ new/podman-py-4.3.0/podman/version.py 2022-10-19 23:32:04.000000000 +0200
@@ -1,4 +1,4 @@
"""Version of PodmanPy."""
-__version__ = "4.2.0"
+__version__ = "4.3.0"
__compatible_version__ = "1.40"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/podman-py-4.2.0/setup.cfg new/podman-py-4.3.0/setup.cfg
--- old/podman-py-4.2.0/setup.cfg 2022-08-10 15:03:52.000000000 +0200
+++ new/podman-py-4.3.0/setup.cfg 2022-10-19 23:32:04.000000000 +0200
@@ -14,7 +14,7 @@
Bug Tracker = https://github.com/containers/podman-py/issues
Libpod API = https://docs.podman.io/en/latest/_static/api.html
classifiers =
- Development Status :: 3 - Alpha
+ Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
@@ -24,6 +24,7 @@
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
+ Programming Language :: Python :: 3.11
Topic :: Software Development :: Libraries :: Python Modules
keywords = podman, libpod
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-psycopg2 for openSUSE:Factory checked in at 2022-11-01 13:42:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-psycopg2 (Old)
and /work/SRC/openSUSE:Factory/.python-psycopg2.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-psycopg2"
Tue Nov 1 13:42:13 2022 rev:41 rq:1032498 version:2.9.5
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-psycopg2/python-psycopg2.changes 2021-12-30 15:56:07.036686774 +0100
+++ /work/SRC/openSUSE:Factory/.python-psycopg2.new.2275/python-psycopg2.changes 2022-11-01 13:42:23.991842340 +0100
@@ -1,0 +2,20 @@
+Fri Oct 28 19:56:31 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam(a)suse.com>
+
+- Update to 2.9.5
+ * Add support for Python 3.11.
+ * Add support for rowcount in MERGE statements in binary packages
+ (ticket`#1497`).
+ * Wheel package compiled against OpenSSL 1.1.1r and PostgreSQL 15 libpq.
+
+- Update to 2.9.4
+ * Fix `~psycopg2.extras.register_composite()`,
+ `~psycopg2.extras.register_range()` with customized search_path
+ (ticket`#1487`).
+ * Handle correctly composite types with names or in schemas requiring escape.
+ * Find ``pg_service.conf file in the ``/etc/postgresql-common`` directory in
+ binary packages (ticket`1365`).
+ * `~psycopg2.errorcodes` map and `~psycopg2.errors` classes updated to
+ PostgreSQL 15.
+ * Wheel package compiled against OpenSSL 1.1.1q and PostgreSQL 14.4
+
+-------------------------------------------------------------------
Old:
----
psycopg2-2.9.3.tar.gz
New:
----
psycopg2-2.9.5.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-psycopg2.spec ++++++
--- /var/tmp/diff_new_pack.es5zoI/_old 2022-11-01 13:42:24.419844618 +0100
+++ /var/tmp/diff_new_pack.es5zoI/_new 2022-11-01 13:42:24.423844640 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-psycopg2
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-psycopg2
-Version: 2.9.3
+Version: 2.9.5
Release: 0
Summary: Python-PostgreSQL Database Adapter
License: LGPL-3.0-or-later AND (LGPL-3.0-or-later OR ZPL-2.0) AND SUSE-GPL-2.0-with-openssl-exception
++++++ psycopg2-2.9.3.tar.gz -> psycopg2-2.9.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/NEWS new/psycopg2-2.9.5/NEWS
--- old/psycopg2-2.9.3/NEWS 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/NEWS 2022-10-25 13:05:48.000000000 +0200
@@ -1,10 +1,34 @@
Current release
---------------
+What's new in psycopg 2.9.5
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- Add support for Python 3.11.
+- Add support for rowcount in MERGE statements in binary packages
+ (:ticket:`#1497`).
+- Wheel package compiled against OpenSSL 1.1.1r and PostgreSQL 15 libpq.
+
+
+What's new in psycopg 2.9.4
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- Fix `~psycopg2.extras.register_composite()`,
+ `~psycopg2.extras.register_range()` with customized :sql:`search_path`
+ (:ticket:`#1487`).
+- Handle correctly composite types with names or in schemas requiring escape.
+- Find ``pg_service.conf`` file in the ``/etc/postgresql-common`` directory in
+ binary packages (:ticket:`#1365`).
+- `~psycopg2.errorcodes` map and `~psycopg2.errors` classes updated to
+ PostgreSQL 15.
+- Wheel package compiled against OpenSSL 1.1.1q and PostgreSQL 14.4 libpq.
+
+
What's new in psycopg 2.9.3
^^^^^^^^^^^^^^^^^^^^^^^^^^^
-- Alpine (musl) wheels now available (:ticket:`#1148`).
+- Alpine (musl) wheels now available (:ticket:`#1392`).
+- macOS arm64 (Apple M1) wheels now available (:ticket:`1482`).
What's new in psycopg 2.9.2
@@ -14,14 +38,14 @@
- `~psycopg2.errorcodes` map and `~psycopg2.errors` classes updated to
PostgreSQL 14.
- Add preliminary support for Python 3.11 (:tickets:`#1376, #1386`).
-- Wheel package compiled against OpenSSL 1.1.1l and PostgreSQL 14.1
+- Wheel package compiled against OpenSSL 1.1.1l and PostgreSQL 14.1 libpq
(:ticket:`#1388`).
What's new in psycopg 2.9.1
^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Fix regression with named `sql.Placeholder` (:ticket:`#1291`).
+- Fix regression with named `~psycopg2.sql.Placeholder` (:ticket:`#1291`).
What's new in psycopg 2.9
@@ -51,7 +75,7 @@
platforms.
- Provide :pep:`600` wheels packages (manylinux_2_24 tag) for aarch64 and
ppc64le platforms.
-- Wheel package compiled against OpenSSL 1.1.1k and PostgreSQL 13.3.
+- Wheel package compiled against OpenSSL 1.1.1k and PostgreSQL 13.3 libpq.
- Build system for Linux/MacOS binary packages moved to GitHub Actions.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/PKG-INFO new/psycopg2-2.9.5/PKG-INFO
--- old/psycopg2-2.9.3/PKG-INFO 2021-12-29 13:51:57.495733500 +0100
+++ new/psycopg2-2.9.5/PKG-INFO 2022-10-25 13:05:49.455371100 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: psycopg2
-Version: 2.9.3
+Version: 2.9.5
Summary: psycopg2 - Python-PostgreSQL Database Adapter
Home-page: https://psycopg.org/
Author: Federico Di Gregorio
@@ -95,6 +95,7 @@
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: C
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/doc/requirements.txt new/psycopg2-2.9.5/doc/requirements.txt
--- old/psycopg2-2.9.3/doc/requirements.txt 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/doc/requirements.txt 2022-10-25 13:05:48.000000000 +0200
@@ -1,8 +1,58 @@
-# Packages only needed to build the docs
-Pygments>=2.2,<2.3
-Sphinx>=1.6,<=1.7
-sphinx-better-theme>=0.1.5,<0.2
-
-# 0.15.2 affected by https://sourceforge.net/p/docutils/bugs/353/
-# Can update to 0.16 after release (currently in rc) but must update Sphinx too
-docutils<0.15
+#
+# This file is autogenerated by pip-compile with python 3.8
+# To update, run:
+#
+# pip-compile requirements.in
+#
+alabaster==0.7.12
+ # via sphinx
+babel==2.9.1
+ # via sphinx
+certifi==2021.10.8
+ # via requests
+charset-normalizer==2.0.12
+ # via requests
+docutils==0.17.1
+ # via sphinx
+idna==3.3
+ # via requests
+imagesize==1.3.0
+ # via sphinx
+importlib-metadata==4.11.3
+ # via sphinx
+jinja2==3.1.1
+ # via sphinx
+markupsafe==2.1.1
+ # via jinja2
+packaging==21.3
+ # via sphinx
+pygments==2.11.2
+ # via sphinx
+pyparsing==3.0.7
+ # via packaging
+pytz==2022.1
+ # via babel
+requests==2.27.1
+ # via sphinx
+snowballstemmer==2.2.0
+ # via sphinx
+sphinx==4.4.0
+ # via -r requirements.in
+sphinx-better-theme==0.1.5
+ # via -r requirements.in
+sphinxcontrib-applehelp==1.0.2
+ # via sphinx
+sphinxcontrib-devhelp==1.0.2
+ # via sphinx
+sphinxcontrib-htmlhelp==2.0.0
+ # via sphinx
+sphinxcontrib-jsmath==1.0.1
+ # via sphinx
+sphinxcontrib-qthelp==1.0.3
+ # via sphinx
+sphinxcontrib-serializinghtml==1.1.5
+ # via sphinx
+urllib3==1.26.9
+ # via requests
+zipp==3.7.0
+ # via importlib-metadata
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/doc/src/cursor.rst new/psycopg2-2.9.5/doc/src/cursor.rst
--- old/psycopg2-2.9.3/doc/src/cursor.rst 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/doc/src/cursor.rst 2022-10-25 13:05:48.000000000 +0200
@@ -208,6 +208,14 @@
Parameters are bounded to the query using the same rules described in
the `~cursor.execute()` method.
+ .. code:: python
+
+ >>> nums = ((1,), (5,), (10,))
+ >>> cur.executemany("INSERT INTO test (num) VALUES (%s)", nums)
+
+ >>> tuples = ((123, "foo"), (42, "bar"), (23, "baz"))
+ >>> cur.executemany("INSERT INTO test (num, data) VALUES (%s, %s)", tuples)
+
.. warning::
In its current implementation this method is not faster than
executing `~cursor.execute()` in a loop. For better performance
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/doc/src/errorcodes.rst new/psycopg2-2.9.5/doc/src/errorcodes.rst
--- old/psycopg2-2.9.3/doc/src/errorcodes.rst 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/doc/src/errorcodes.rst 2022-10-25 13:05:48.000000000 +0200
@@ -50,7 +50,7 @@
'42P01'
Constants representing all the error values defined by PostgreSQL versions
-between 8.1 and 13 are included in the module.
+between 8.1 and 15 are included in the module.
.. autofunction:: lookup(code)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/doc/src/errors.rst new/psycopg2-2.9.5/doc/src/errors.rst
--- old/psycopg2-2.9.3/doc/src/errors.rst 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/doc/src/errors.rst 2022-10-25 13:05:48.000000000 +0200
@@ -14,11 +14,15 @@
.. versionchanged:: 2.8.6 added errors introduced in PostgreSQL 13
+.. versionchanged:: 2.9.2 added errors introduced in PostgreSQL 14
+
+.. versionchanged:: 2.9.4 added errors introduced in PostgreSQL 15
+
This module exposes the classes psycopg raises upon receiving an error from
the database with a :sql:`SQLSTATE` value attached (available in the
`~psycopg2.Error.pgcode` attribute). The content of the module is generated
from the PostgreSQL source code and includes classes for every error defined
-by PostgreSQL in versions between 9.1 and 13.
+by PostgreSQL in versions between 9.1 and 15.
Every class in the module is named after what referred as "condition name" `in
the documentation`__, converted to CamelCase: e.g. the error 22012,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/doc/src/extras.rst new/psycopg2-2.9.5/doc/src/extras.rst
--- old/psycopg2-2.9.3/doc/src/extras.rst 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/doc/src/extras.rst 2022-10-25 13:05:48.000000000 +0200
@@ -1029,6 +1029,14 @@
.. autofunction:: execute_batch
+ .. code:: python
+
+ >>> nums = ((1,), (5,), (10,))
+ >>> execute_batch(cur, "INSERT INTO test (num) VALUES (%s)", nums)
+
+ >>> tuples = ((123, "foo"), (42, "bar"), (23, "baz"))
+ >>> execute_batch(cur, "INSERT INTO test (num, data) VALUES (%s, %s)", tuples)
+
.. versionadded:: 2.7
.. note::
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/doc/src/install.rst new/psycopg2-2.9.5/doc/src/install.rst
--- old/psycopg2-2.9.3/doc/src/install.rst 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/doc/src/install.rst 2022-10-25 13:05:48.000000000 +0200
@@ -131,10 +131,17 @@
..
NOTE: keep consistent with setup.py and the /features/ page.
-- Python versions from 3.6 to 3.10
-- PostgreSQL server versions from 7.4 to 14
+- Python versions from 3.6 to 3.11
+- PostgreSQL server versions from 7.4 to 15
- PostgreSQL client library version from 9.1
+.. note::
+
+ Not all the psycopg2 versions support all the supported Python versions.
+
+ Please see the :ref:`release notes <news>` to verify when the support for
+ a new Python version was added and when the support for an old Python
+ version was removed.
.. _build-prerequisites:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/doc/src/news.rst new/psycopg2-2.9.5/doc/src/news.rst
--- old/psycopg2-2.9.3/doc/src/news.rst 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/doc/src/news.rst 2022-10-25 13:05:48.000000000 +0200
@@ -2,6 +2,8 @@
single: Release notes
single: News
+.. _news:
+
Release notes
=============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/doc/src/sql.rst new/psycopg2-2.9.5/doc/src/sql.rst
--- old/psycopg2-2.9.3/doc/src/sql.rst 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/doc/src/sql.rst 2022-10-25 13:05:48.000000000 +0200
@@ -33,7 +33,7 @@
# This works, but it is not optimal
table_name = 'my_table'
cur.execute(
- "insert into %s values (%%s, %%s)" % ext.quote_ident(table_name),
+ "insert into %s values (%%s, %%s)" % ext.quote_ident(table_name, cur),
[10, 20])
This is now safe, but it somewhat ad-hoc. In case, for some reason, it is
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/lib/_range.py new/psycopg2-2.9.5/lib/_range.py
--- old/psycopg2-2.9.3/lib/_range.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/lib/_range.py 2022-10-25 13:05:48.000000000 +0200
@@ -143,10 +143,6 @@
def __bool__(self):
return self._bounds is not None
- def __nonzero__(self):
- # Python 2 compatibility
- return type(self).__bool__(self)
-
def __eq__(self, other):
if not isinstance(other, Range):
return False
@@ -367,33 +363,54 @@
schema = 'public'
# get the type oid and attributes
- try:
- curs.execute("""\
-select rngtypid, rngsubtype,
- (select typarray from pg_type where oid = rngtypid)
+ curs.execute("""\
+select rngtypid, rngsubtype, typarray
from pg_range r
join pg_type t on t.oid = rngtypid
join pg_namespace ns on ns.oid = typnamespace
where typname = %s and ns.nspname = %s;
""", (tname, schema))
+ rec = curs.fetchone()
- except ProgrammingError:
- if not conn.autocommit:
- conn.rollback()
- raise
- else:
- rec = curs.fetchone()
+ if not rec:
+ # The above algorithm doesn't work for customized seach_path
+ # (#1487) The implementation below works better, but, to guarantee
+ # backwards compatibility, use it only if the original one failed.
+ try:
+ savepoint = False
+ # Because we executed statements earlier, we are either INTRANS
+ # or we are IDLE only if the transaction is autocommit, in
+ # which case we don't need the savepoint anyway.
+ if conn.status == STATUS_IN_TRANSACTION:
+ curs.execute("SAVEPOINT register_type")
+ savepoint = True
- # revert the status of the connection as before the command
- if (conn_status != STATUS_IN_TRANSACTION
- and not conn.autocommit):
- conn.rollback()
+ curs.execute("""\
+SELECT rngtypid, rngsubtype, typarray, typname, nspname
+from pg_range r
+join pg_type t on t.oid = rngtypid
+join pg_namespace ns on ns.oid = typnamespace
+WHERE t.oid = %s::regtype
+""", (name, ))
+ except ProgrammingError:
+ pass
+ else:
+ rec = curs.fetchone()
+ if rec:
+ tname, schema = rec[3:]
+ finally:
+ if savepoint:
+ curs.execute("ROLLBACK TO SAVEPOINT register_type")
+
+ # revert the status of the connection as before the command
+ if conn_status != STATUS_IN_TRANSACTION and not conn.autocommit:
+ conn.rollback()
if not rec:
raise ProgrammingError(
- f"PostgreSQL type '{name}' not found")
+ f"PostgreSQL range '{name}' not found")
- type, subtype, array = rec
+ type, subtype, array = rec[:3]
return RangeCaster(name, pyrange,
oid=type, subtype_oid=subtype, array_oid=array)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/lib/errorcodes.py new/psycopg2-2.9.5/lib/errorcodes.py
--- old/psycopg2-2.9.3/lib/errorcodes.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/lib/errorcodes.py 2022-10-25 13:05:48.000000000 +0200
@@ -223,6 +223,7 @@
TOO_MANY_JSON_ARRAY_ELEMENTS = '2203D'
TOO_MANY_JSON_OBJECT_MEMBERS = '2203E'
SQL_JSON_SCALAR_REQUIRED = '2203F'
+SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE = '2203G'
FLOATING_POINT_EXCEPTION = '22P01'
INVALID_TEXT_REPRESENTATION = '22P02'
INVALID_BINARY_REPRESENTATION = '22P03'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/lib/extras.py new/psycopg2-2.9.5/lib/extras.py
--- old/psycopg2-2.9.3/lib/extras.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/lib/extras.py 2022-10-25 13:05:48.000000000 +0200
@@ -357,10 +357,6 @@
except StopIteration:
return
- # ascii except alnum and underscore
- _re_clean = _re.compile(
- '[' + _re.escape(' !"#$%&\'()*+,-./:;<=>?@[\\]^`{|}~') + ']')
-
def _make_nt(self):
key = tuple(d[0] for d in self.description) if self.description else ()
return self._cached_make_nt(key)
@@ -369,7 +365,7 @@
def _do_make_nt(cls, key):
fields = []
for s in key:
- s = cls._re_clean.sub('_', s)
+ s = _re_clean.sub('_', s)
# Python identifier cannot start with numbers, namedtuple fields
# cannot start with underscore. So...
if s[0] == '_' or '0' <= s[0] <= '9':
@@ -1061,6 +1057,7 @@
return rv
def _create_type(self, name, attnames):
+ name = _re_clean.sub('_', name)
self.type = namedtuple(name, attnames)
self._ctor = self.type._make
@@ -1098,9 +1095,41 @@
recs = curs.fetchall()
+ if not recs:
+ # The above algorithm doesn't work for customized seach_path
+ # (#1487) The implementation below works better, but, to guarantee
+ # backwards compatibility, use it only if the original one failed.
+ try:
+ savepoint = False
+ # Because we executed statements earlier, we are either INTRANS
+ # or we are IDLE only if the transaction is autocommit, in
+ # which case we don't need the savepoint anyway.
+ if conn.status == _ext.STATUS_IN_TRANSACTION:
+ curs.execute("SAVEPOINT register_type")
+ savepoint = True
+
+ curs.execute("""\
+SELECT t.oid, %s, attname, atttypid, typname, nspname
+FROM pg_type t
+JOIN pg_namespace ns ON typnamespace = ns.oid
+JOIN pg_attribute a ON attrelid = typrelid
+WHERE t.oid = %%s::regtype
+ AND attnum > 0 AND NOT attisdropped
+ORDER BY attnum;
+""" % typarray, (name, ))
+ except psycopg2.ProgrammingError:
+ pass
+ else:
+ recs = curs.fetchall()
+ if recs:
+ tname = recs[0][4]
+ schema = recs[0][5]
+ finally:
+ if savepoint:
+ curs.execute("ROLLBACK TO SAVEPOINT register_type")
+
# revert the status of the connection as before the command
- if (conn_status != _ext.STATUS_IN_TRANSACTION
- and not conn.autocommit):
+ if conn_status != _ext.STATUS_IN_TRANSACTION and not conn.autocommit:
conn.rollback()
if not recs:
@@ -1304,3 +1333,8 @@
raise ValueError("the query doesn't contain any '%s' placeholder")
return pre, post
+
+
+# ascii except alnum and underscore
+_re_clean = _re.compile(
+ '[' + _re.escape(' !"#$%&\'()*+,-./:;<=>?@[\\]^`{|}~') + ']')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/psycopg/sqlstate_errors.h new/psycopg2-2.9.5/psycopg/sqlstate_errors.h
--- old/psycopg2-2.9.3/psycopg/sqlstate_errors.h 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/psycopg/sqlstate_errors.h 2022-10-25 13:05:48.000000000 +0200
@@ -111,6 +111,7 @@
{"2203D", "TooManyJsonArrayElements"},
{"2203E", "TooManyJsonObjectMembers"},
{"2203F", "SqlJsonScalarRequired"},
+{"2203G", "SqlJsonItemCannotBeCastToTargetType"},
{"22P01", "FloatingPointException"},
{"22P02", "InvalidTextRepresentation"},
{"22P03", "InvalidBinaryRepresentation"},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/psycopg2.egg-info/PKG-INFO new/psycopg2-2.9.5/psycopg2.egg-info/PKG-INFO
--- old/psycopg2-2.9.3/psycopg2.egg-info/PKG-INFO 2021-12-29 13:51:57.000000000 +0100
+++ new/psycopg2-2.9.5/psycopg2.egg-info/PKG-INFO 2022-10-25 13:05:49.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: psycopg2
-Version: 2.9.3
+Version: 2.9.5
Summary: psycopg2 - Python-PostgreSQL Database Adapter
Home-page: https://psycopg.org/
Author: Federico Di Gregorio
@@ -95,6 +95,7 @@
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: C
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/psycopg2.egg-info/SOURCES.txt new/psycopg2-2.9.5/psycopg2.egg-info/SOURCES.txt
--- old/psycopg2-2.9.3/psycopg2.egg-info/SOURCES.txt 2021-12-29 13:51:57.000000000 +0100
+++ new/psycopg2-2.9.5/psycopg2.egg-info/SOURCES.txt 2022-10-25 13:05:49.000000000 +0200
@@ -138,12 +138,14 @@
scripts/build/appveyor.py
scripts/build/build_libpq.sh
scripts/build/build_macos.sh
+scripts/build/build_macos_arm64.sh
scripts/build/build_manylinux2014.sh
scripts/build/build_manylinux_2_24.sh
scripts/build/build_musllinux_1_1.sh
scripts/build/build_sdist.sh
scripts/build/download_packages_appveyor.py
scripts/build/download_packages_github.py
+scripts/build/run_build_macos_arm64.sh
scripts/build/strip_wheel.sh
tests/__init__.py
tests/dbapi20.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/scripts/build/build_libpq.sh new/psycopg2-2.9.5/scripts/build/build_libpq.sh
--- old/psycopg2-2.9.3/scripts/build/build_libpq.sh 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/scripts/build/build_libpq.sh 2022-10-25 13:05:48.000000000 +0200
@@ -5,10 +5,14 @@
set -euo pipefail
set -x
-openssl_version="1.1.1l"
+# Last release: https://www.postgresql.org/ftp/source/
+postgres_version="15.0"
+# last release: https://www.openssl.org/source/
+openssl_version="1.1.1r"
+# last release: https://openldap.org/software/download/
ldap_version="2.4.59"
-sasl_version="2.1.27"
-postgres_version="14.1"
+# last release: https://github.com/cyrusimap/cyrus-sasl/releases
+sasl_version="2.1.28"
yum install -y zlib-devel krb5-devel pam-devel
@@ -113,7 +117,8 @@
fi
./configure --prefix=/usr/local --without-readline \
- --with-gssapi --with-openssl --with-pam --with-ldap
+ --with-gssapi --with-openssl --with-pam --with-ldap \
+ --sysconfdir=/etc/postgresql-common
make -C src/interfaces/libpq
make -C src/bin/pg_config
make -C src/include
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/scripts/build/build_macos_arm64.sh new/psycopg2-2.9.5/scripts/build/build_macos_arm64.sh
--- old/psycopg2-2.9.3/scripts/build/build_macos_arm64.sh 1970-01-01 01:00:00.000000000 +0100
+++ new/psycopg2-2.9.5/scripts/build/build_macos_arm64.sh 2022-10-25 13:05:48.000000000 +0200
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+# Build psycopg2-binary wheel packages for Apple M1 (cpNNN-macosx_arm64)
+#
+# This script is designed to run on Scaleway Apple Silicon machines.
+#
+# The script cannot be run as sudo (installing brew fails), but requires sudo,
+# so it can pretty much only be executed by a sudo user as it is.
+
+set -euo pipefail
+set -x
+
+python_versions="3.8.10 3.9.13 3.10.5 3.11"
+postgres_version=15
+
+# Move to the root of the project
+dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+cd "${dir}/../../"
+
+# Add /usr/local/bin to the path. It seems it's not, in non-interactive sessions
+if ! (echo $PATH | grep -q '/usr/local/bin'); then
+ export PATH=/usr/local/bin:$PATH
+fi
+
+# Install brew, if necessary. Otherwise just make sure it's in the path
+if [[ -x /opt/homebrew/bin/brew ]]; then
+ eval "$(/opt/homebrew/bin/brew shellenv)"
+else
+ command -v brew > /dev/null || (
+ # Not necessary: already installed
+ # xcode-select --install
+ NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL \
+ https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
+ )
+ eval "$(/opt/homebrew/bin/brew shellenv)"
+fi
+
+# Install PostgreSQL, if necessary
+command -v pg_config > /dev/null || (
+ brew install postgresql@${postgres_version}
+ # Currently not working
+ # brew services start postgresql@${postgres_version}
+ pg_ctl \
+ -D /opt/homebrew/var/postgresql@${postgres_version} \
+ -l /opt/homebrew/var/log/postgresql(a)${postgres_version}.log \
+ start
+)
+
+# Install the Python versions we want to build
+for ver3 in $python_versions; do
+ ver2=$(echo $ver3 | sed 's/\([^\.]*\)\(\.[^\.]*\)\(.*\)/\1\2/')
+ command -v python${ver2} > /dev/null || (
+ (cd /tmp &&
+ curl -fsSl -O \
+ https://www.python.org/ftp/python/${ver3}/python-${ver3}-macos11.pkg)
+ sudo installer -pkg /tmp/python-${ver3}-macos11.pkg -target /
+ )
+done
+
+# Create a virtualenv where to work
+if [[ ! -x .venv/bin/python ]]; then
+ python3 -m venv .venv
+fi
+
+source .venv/bin/activate
+pip install cibuildwheel
+
+# Build the binary packages
+export CIBW_PLATFORM=macos
+export CIBW_ARCHS=arm64
+export CIBW_BUILD='cp{38,39,310}-*'
+export CIBW_TEST_COMMAND='python -c "import tests; tests.unittest.main(defaultTest=\"tests.test_suite\")"'
+
+export PSYCOPG2_TESTDB=postgres
+export PYTHONPATH=$(pwd)
+
+# For some reason, cibuildwheel tests says that psycopg2 is already installed,
+# refuses to install, then promptly fails import. So, please, seriously,
+# install this thing.
+export PIP_FORCE_REINSTALL=1
+
+# Replace the package name
+sed -i .bak 's/^setup(name="psycopg2"/setup(name="psycopg2-binary"/' setup.py
+
+cibuildwheel
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/scripts/build/download_packages_appveyor.py new/psycopg2-2.9.5/scripts/build/download_packages_appveyor.py
--- old/psycopg2-2.9.3/scripts/build/download_packages_appveyor.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/scripts/build/download_packages_appveyor.py 2022-10-25 13:05:48.000000000 +0200
@@ -69,7 +69,7 @@
fn = af["fileName"]
if fn.startswith("dist/"):
fn = fn.split("/", 1)[1]
- dest = Path("packages") / fn
+ dest = Path("wheelhouse") / fn
logger.info(f"downloading {dest}")
resp = s.get(
f"{API_URL}/buildjobs/{job['jobId']}/artifacts/{af['fileName']}"
@@ -81,7 +81,7 @@
with dest.open("wb") as f:
f.write(resp.content)
- logger.info("now you can run: 'twine upload -s packages/*'")
+ logger.info("now you can run: 'twine upload -s wheelhouse/*'")
def parse_cmdline():
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/scripts/build/download_packages_github.py new/psycopg2-2.9.5/scripts/build/download_packages_github.py
--- old/psycopg2-2.9.3/scripts/build/download_packages_github.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/scripts/build/download_packages_github.py 2022-10-25 13:05:48.000000000 +0200
@@ -57,7 +57,7 @@
resp.raise_for_status()
artifacts = resp.json()["artifacts"]
- dest = Path("packages")
+ dest = Path("wheelhouse")
if not dest.exists():
logger.info(f"creating dir {dest}")
dest.mkdir(parents=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/scripts/build/run_build_macos_arm64.sh new/psycopg2-2.9.5/scripts/build/run_build_macos_arm64.sh
--- old/psycopg2-2.9.3/scripts/build/run_build_macos_arm64.sh 1970-01-01 01:00:00.000000000 +0100
+++ new/psycopg2-2.9.5/scripts/build/run_build_macos_arm64.sh 2022-10-25 13:05:48.000000000 +0200
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# Build psycopg2-binary wheel packages for Apple M1 (cpNNN-macosx_arm64)
+#
+# This script is designed to run on a local machine: it will clone the repos
+# remotely and execute the `build_macos_arm64.sh` script remotely, then will
+# download the built packages. A tag to build must be specified.
+#
+# In order to run the script, the `m1` host must be specified in
+# `~/.ssh/config`; for instance:
+#
+# Host m1
+# User m1
+# HostName 1.2.3.4
+
+set -euo pipefail
+# set -x
+
+tag=${1:-}
+
+if [[ ! "${tag}" ]]; then
+ echo "Usage: $0 TAG" >&2
+ exit 2
+fi
+
+rdir=psycobuild
+
+# Clone the repos
+ssh m1 rm -rf "${rdir}"
+ssh m1 git clone https://github.com/psycopg/psycopg2.git --branch ${tag} "${rdir}"
+
+# Allow sudoing without password, to allow brew to install
+ssh -t m1 bash -c \
+ 'test -f /etc/sudoers.d/m1 || echo "m1 ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/m1'
+
+# Build the wheel packages
+ssh m1 "${rdir}/scripts/build/build_macos_arm64.sh"
+
+# Transfer the packages locally
+scp -r "m1:${rdir}/wheelhouse" .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/scripts/make_errorcodes.py new/psycopg2-2.9.5/scripts/make_errorcodes.py
--- old/psycopg2-2.9.3/scripts/make_errorcodes.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/scripts/make_errorcodes.py 2022-10-25 13:05:48.000000000 +0200
@@ -33,7 +33,7 @@
file_start = read_base_file(filename)
# If you add a version to the list fix the docs (in errorcodes.rst)
classes, errors = fetch_errors(
- ['9.1', '9.2', '9.3', '9.4', '9.5', '9.6', '10', '11', '12', '13', '14'])
+ '9.1 9.2 9.3 9.4 9.5 9.6 10 11 12 13 14 15'.split())
disambiguate(errors)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/scripts/make_errors.py new/psycopg2-2.9.5/scripts/make_errors.py
--- old/psycopg2-2.9.3/scripts/make_errors.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/scripts/make_errors.py 2022-10-25 13:05:48.000000000 +0200
@@ -30,7 +30,7 @@
# If you add a version to the list fix the docs (in errors.rst)
classes, errors = fetch_errors(
- ['9.1', '9.2', '9.3', '9.4', '9.5', '9.6', '10', '11', '12', '13', '14'])
+ '9.1 9.2 9.3 9.4 9.5 9.6 10 11 12 13 14 15'.split())
f = open(filename, "w")
print("/*\n * Autogenerated by 'scripts/make_errors.py'.\n */\n", file=f)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/setup.py new/psycopg2-2.9.5/setup.py
--- old/psycopg2-2.9.3/setup.py 2021-12-29 13:51:57.000000000 +0100
+++ new/psycopg2-2.9.5/setup.py 2022-10-25 13:05:48.000000000 +0200
@@ -44,7 +44,7 @@
# Take a look at https://www.python.org/dev/peps/pep-0440/
# for a consistent versioning pattern.
-PSYCOPG_VERSION = '2.9.3'
+PSYCOPG_VERSION = '2.9.5'
# note: if you are changing the list of supported Python version please fix
@@ -60,6 +60,7 @@
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
+Programming Language :: Python :: 3.11
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: Implementation :: CPython
Programming Language :: C
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/tests/test_async.py new/psycopg2-2.9.5/tests/test_async.py
--- old/psycopg2-2.9.3/tests/test_async.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/tests/test_async.py 2022-10-25 13:05:48.000000000 +0200
@@ -390,6 +390,7 @@
# fetching from the correct cursor works
self.assertEquals(cur1.fetchone()[0], 1)
+ @skip_if_crdb("batch statements", version="< 22.1")
def test_error(self):
cur = self.conn.cursor()
cur.execute("insert into table1 values (%s)", (1, ))
@@ -402,9 +403,8 @@
# this should fail as well (Postgres behaviour)
self.assertRaises(psycopg2.IntegrityError, self.wait, cur)
# but this should work
- if crdb_version(self.sync_conn) is None:
- cur.execute("insert into table1 values (%s)", (2, ))
- self.wait(cur)
+ cur.execute("insert into table1 values (%s)", (2, ))
+ self.wait(cur)
# and the cursor should be usable afterwards
cur.execute("insert into table1 values (%s)", (3, ))
self.wait(cur)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/tests/test_connection.py new/psycopg2-2.9.5/tests/test_connection.py
--- old/psycopg2-2.9.3/tests/test_connection.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/tests/test_connection.py 2022-10-25 13:05:48.000000000 +0200
@@ -1928,11 +1928,16 @@
self.assertIsInstance(self.conn.info.ssl_attribute(attrib), str)
else:
for attrib in attribs:
+ # Behaviour changed in PostgreSQL 15
+ if attrib == "library":
+ continue
self.assertIsNone(self.conn.info.ssl_attribute(attrib))
self.assertIsNone(self.conn.info.ssl_attribute('wat'))
for attrib in attribs:
+ if attrib == "library":
+ continue
self.assertIsNone(self.bconn.info.ssl_attribute(attrib))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/tests/test_cursor.py new/psycopg2-2.9.5/tests/test_cursor.py
--- old/psycopg2-2.9.3/tests/test_cursor.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/tests/test_cursor.py 2022-10-25 13:05:48.000000000 +0200
@@ -379,6 +379,12 @@
@skip_before_postgres(8, 2)
def test_rowcount_on_executemany_returning(self):
cur = self.conn.cursor()
+ try:
+ cur.execute("drop table execmany")
+ self.conn.commit()
+ except psycopg2.DatabaseError:
+ self.conn.rollback()
+
cur.execute("create table execmany(id serial primary key, data int)")
cur.executemany(
"insert into execmany (data) values (%s)",
@@ -412,7 +418,7 @@
self.assert_(curs.pgresult_ptr is None)
-@skip_if_crdb("named cursor")
+@skip_if_crdb("named cursor", version="< 22.1")
class NamedCursorTests(ConnectingTestCase):
def test_invalid_name(self):
curs = self.conn.cursor()
@@ -436,6 +442,7 @@
curs.execute("insert into withhold values (%s)", (i,))
curs.close()
+ @skip_if_crdb("cursor with hold")
def test_withhold(self):
self.assertRaises(psycopg2.ProgrammingError, self.conn.cursor,
withhold=True)
@@ -460,6 +467,7 @@
curs.execute("drop table withhold")
self.conn.commit()
+ @skip_if_crdb("cursor with hold")
def test_withhold_no_begin(self):
self._create_withhold_table()
curs = self.conn.cursor("w", withhold=True)
@@ -484,6 +492,7 @@
self.assertEqual(self.conn.info.transaction_status,
psycopg2.extensions.TRANSACTION_STATUS_IDLE)
+ @skip_if_crdb("cursor with hold")
def test_withhold_autocommit(self):
self._create_withhold_table()
self.conn.commit()
@@ -506,6 +515,7 @@
self.assertEqual(self.conn.info.transaction_status,
psycopg2.extensions.TRANSACTION_STATUS_IDLE)
+ @skip_if_crdb("scroll cursor")
def test_scrollable(self):
self.assertRaises(psycopg2.ProgrammingError, self.conn.cursor,
scrollable=True)
@@ -679,6 +689,7 @@
self.assertRaises((IndexError, psycopg2.ProgrammingError),
cur.scroll, 1)
+ @skip_if_crdb("scroll cursor")
@skip_before_postgres(8, 0)
def test_scroll_named(self):
cur = self.conn.cursor('tmp', scrollable=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/tests/test_extras_dictcursor.py new/psycopg2-2.9.5/tests/test_extras_dictcursor.py
--- old/psycopg2-2.9.3/tests/test_extras_dictcursor.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/tests/test_extras_dictcursor.py 2022-10-25 13:05:48.000000000 +0200
@@ -64,7 +64,7 @@
class ExtrasDictCursorTests(_DictCursorBase):
"""Test if DictCursor extension class works."""
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("named cursor", version="< 22.1")
def testDictConnCursorArgs(self):
self.conn.close()
self.conn = self.connect(connection_factory=psycopg2.extras.DictConnection)
@@ -132,19 +132,19 @@
return row
self._testWithNamedCursor(getter)
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("greedy cursor")
@skip_before_postgres(8, 2)
def testDictCursorWithNamedCursorNotGreedy(self):
curs = self.conn.cursor('tmp', cursor_factory=psycopg2.extras.DictCursor)
self._testNamedCursorNotGreedy(curs)
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("named cursor", version="< 22.1")
@skip_before_postgres(8, 0)
def testDictCursorWithNamedCursorIterRowNumber(self):
curs = self.conn.cursor('tmp', cursor_factory=psycopg2.extras.DictCursor)
self._testIterRowNumber(curs)
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("named cursor", version="< 22.1")
def _testWithNamedCursor(self, getter):
curs = self.conn.cursor('aname', cursor_factory=psycopg2.extras.DictCursor)
curs.execute("SELECT * FROM ExtrasDictCursorTests")
@@ -285,19 +285,19 @@
return row
self._testWithNamedCursorReal(getter)
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("greedy cursor")
@skip_before_postgres(8, 2)
def testDictCursorRealWithNamedCursorNotGreedy(self):
curs = self.conn.cursor('tmp', cursor_factory=psycopg2.extras.RealDictCursor)
self._testNamedCursorNotGreedy(curs)
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("named cursor", version="< 22.1")
@skip_before_postgres(8, 0)
def testDictCursorRealWithNamedCursorIterRowNumber(self):
curs = self.conn.cursor('tmp', cursor_factory=psycopg2.extras.RealDictCursor)
self._testIterRowNumber(curs)
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("named cursor", version="< 22.1")
def _testWithNamedCursorReal(self, getter):
curs = self.conn.cursor('aname',
cursor_factory=psycopg2.extras.RealDictCursor)
@@ -376,7 +376,7 @@
curs.execute("INSERT INTO nttest VALUES (3, 'baz')")
self.conn.commit()
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("named cursor", version="< 22.1")
def test_cursor_args(self):
cur = self.conn.cursor('foo', cursor_factory=psycopg2.extras.DictCursor)
self.assertEqual(cur.name, 'foo')
@@ -533,7 +533,7 @@
finally:
NamedTupleCursor._make_nt = f_orig
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("named cursor", version="< 22.1")
@skip_before_postgres(8, 0)
def test_named(self):
curs = self.conn.cursor('tmp')
@@ -544,28 +544,28 @@
recs.extend(curs.fetchall())
self.assertEqual(list(range(10)), [t.i for t in recs])
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("named cursor", version="< 22.1")
def test_named_fetchone(self):
curs = self.conn.cursor('tmp')
curs.execute("""select 42 as i""")
t = curs.fetchone()
self.assertEqual(t.i, 42)
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("named cursor", version="< 22.1")
def test_named_fetchmany(self):
curs = self.conn.cursor('tmp')
curs.execute("""select 42 as i""")
recs = curs.fetchmany(10)
self.assertEqual(recs[0].i, 42)
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("named cursor", version="< 22.1")
def test_named_fetchall(self):
curs = self.conn.cursor('tmp')
curs.execute("""select 42 as i""")
recs = curs.fetchall()
self.assertEqual(recs[0].i, 42)
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("greedy cursor")
@skip_before_postgres(8, 2)
def test_not_greedy(self):
curs = self.conn.cursor('tmp')
@@ -580,7 +580,7 @@
self.assert_(recs[1].ts - recs[0].ts < timedelta(seconds=0.005))
self.assert_(recs[2].ts - recs[1].ts > timedelta(seconds=0.0099))
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("named cursor", version="< 22.1")
@skip_before_postgres(8, 0)
def test_named_rownumber(self):
curs = self.conn.cursor('tmp')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/tests/test_green.py new/psycopg2-2.9.5/tests/test_green.py
--- old/psycopg2-2.9.3/tests/test_green.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/tests/test_green.py 2022-10-25 13:05:48.000000000 +0200
@@ -219,7 +219,7 @@
self.fail("you should have had a success or an error by now")
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("named cursor", version="< 22.1")
def test_errors_named_cursor(self):
for i in range(100):
self.to_error = None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/tests/test_types_basic.py new/psycopg2-2.9.5/tests/test_types_basic.py
--- old/psycopg2-2.9.3/tests/test_types_basic.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/tests/test_types_basic.py 2022-10-25 13:05:48.000000000 +0200
@@ -272,6 +272,8 @@
]:
curs.execute("select %s::int[]", (a,))
self.assertEqual(curs.fetchone()[0], a)
+ curs.execute("select array[%s::int[]]", (a,))
+ self.assertEqual(curs.fetchone()[0], [a])
def testTypeRoundtripBytes(self):
o1 = bytes(range(256))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/tests/test_types_extras.py new/psycopg2-2.9.5/tests/test_types_extras.py
--- old/psycopg2-2.9.3/tests/test_types_extras.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/tests/test_types_extras.py 2022-10-25 13:05:48.000000000 +0200
@@ -585,6 +585,68 @@
self.assertEqual(curs.fetchone()[0], (4, 8))
@skip_if_no_composite
+ def test_composite_namespace_path(self):
+ curs = self.conn.cursor()
+ curs.execute("""
+ select nspname from pg_namespace
+ where nspname = 'typens';
+ """)
+ if not curs.fetchone():
+ curs.execute("create schema typens;")
+ self.conn.commit()
+
+ self._create_type("typens.typensp_ii",
+ [("a", "integer"), ("b", "integer")])
+ curs.execute("set search_path=typens,public")
+ t = psycopg2.extras.register_composite(
+ "typensp_ii", self.conn)
+ self.assertEqual(t.schema, 'typens')
+ curs.execute("select (4,8)::typensp_ii")
+ self.assertEqual(curs.fetchone()[0], (4, 8))
+
+ @skip_if_no_composite
+ def test_composite_weird_name(self):
+ curs = self.conn.cursor()
+ curs.execute("""
+ select nspname from pg_namespace
+ where nspname = 'qux.quux';
+ """)
+ if not curs.fetchone():
+ curs.execute('create schema "qux.quux";')
+
+ self._create_type('"qux.quux"."foo.bar"',
+ [("a", "integer"), ("b", "integer")])
+ t = psycopg2.extras.register_composite(
+ '"qux.quux"."foo.bar"', self.conn)
+ self.assertEqual(t.name, 'foo.bar')
+ self.assertEqual(t.schema, 'qux.quux')
+ curs.execute('select (4,8)::"qux.quux"."foo.bar"')
+ self.assertEqual(curs.fetchone()[0], (4, 8))
+
+ @skip_if_no_composite
+ def test_composite_not_found(self):
+
+ self.assertRaises(
+ psycopg2.ProgrammingError, psycopg2.extras.register_composite,
+ "nosuchtype", self.conn)
+ self.assertEqual(self.conn.status, ext.STATUS_READY)
+
+ cur = self.conn.cursor()
+ cur.execute("select 1")
+ self.assertRaises(
+ psycopg2.ProgrammingError, psycopg2.extras.register_composite,
+ "nosuchtype", self.conn)
+
+ self.assertEqual(self.conn.status, ext.STATUS_IN_TRANSACTION)
+
+ self.conn.rollback()
+ self.conn.autocommit = True
+ self.assertRaises(
+ psycopg2.ProgrammingError, psycopg2.extras.register_composite,
+ "nosuchtype", self.conn)
+ self.assertEqual(self.conn.status, ext.STATUS_READY)
+
+ @skip_if_no_composite
@skip_before_postgres(8, 4)
def test_composite_array(self):
self._create_type("type_isd",
@@ -710,22 +772,15 @@
def _create_type(self, name, fields):
curs = self.conn.cursor()
try:
+ curs.execute("savepoint x")
curs.execute(f"drop type {name} cascade;")
except psycopg2.ProgrammingError:
- self.conn.rollback()
+ curs.execute("rollback to savepoint x")
curs.execute("create type {} as ({});".format(name,
", ".join(["%s %s" % p for p in fields])))
- if '.' in name:
- schema, name = name.split('.')
- else:
- schema = 'public'
-
- curs.execute("""\
- SELECT t.oid
- FROM pg_type t JOIN pg_namespace ns ON typnamespace = ns.oid
- WHERE typname = %s and nspname = %s;
- """, (name, schema))
+
+ curs.execute("SELECT %s::regtype::oid", (name, ))
oid = curs.fetchone()[0]
self.conn.commit()
return oid
@@ -1560,6 +1615,18 @@
cur = self.conn.cursor()
self.assertRaises(psycopg2.ProgrammingError,
register_range, 'nosuchrange', 'FailRange', cur)
+ self.assertEqual(self.conn.status, ext.STATUS_READY)
+
+ cur.execute("select 1")
+ self.assertRaises(psycopg2.ProgrammingError,
+ register_range, 'nosuchrange', 'FailRange', cur)
+
+ self.assertEqual(self.conn.status, ext.STATUS_IN_TRANSACTION)
+
+ self.conn.rollback()
+ self.conn.autocommit = True
+ self.assertRaises(psycopg2.ProgrammingError,
+ register_range, 'nosuchrange', 'FailRange', cur)
@restore_types
def test_schema_range(self):
@@ -1574,7 +1641,7 @@
register_range('r1', 'r1', cur)
ra2 = register_range('r2', 'r2', cur)
rars2 = register_range('rs.r2', 'r2', cur)
- register_range('rs.r3', 'r3', cur)
+ rars3 = register_range('rs.r3', 'r3', cur)
self.assertNotEqual(
ra2.typecaster.values[0],
@@ -1588,6 +1655,27 @@
register_range, 'rs.r1', 'FailRange', cur)
cur.execute("rollback to savepoint x;")
+ cur2 = self.conn.cursor()
+ cur2.execute("set local search_path to rs,public")
+ ra3 = register_range('r3', 'r3', cur2)
+ self.assertEqual(ra3.typecaster.values[0], rars3.typecaster.values[0])
+
+ @skip_if_no_composite
+ def test_rang_weird_name(self):
+ cur = self.conn.cursor()
+ cur.execute("""
+ select nspname from pg_namespace
+ where nspname = 'qux.quux';
+ """)
+ if not cur.fetchone():
+ cur.execute('create schema "qux.quux";')
+
+ cur.execute('create type "qux.quux"."foo.range" as range (subtype=text)')
+ r = psycopg2.extras.register_range(
+ '"qux.quux"."foo.range"', "foorange", cur)
+ cur.execute('''select '[a,z]'::"qux.quux"."foo.range"''')
+ self.assertEqual(cur.fetchone()[0], r.range('a', 'z', '[]'))
+
def test_suite():
return unittest.TestLoader().loadTestsFromName(__name__)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/tests/test_with.py new/psycopg2-2.9.5/tests/test_with.py
--- old/psycopg2-2.9.3/tests/test_with.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/tests/test_with.py 2022-10-25 13:05:48.000000000 +0200
@@ -290,7 +290,7 @@
self.assert_(curs.closed)
self.assert_(closes)
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("named cursor", version="< 22.1")
def test_exception_swallow(self):
# bug #262: __exit__ calls cur.close() that hides the exception
# with another error.
@@ -304,7 +304,7 @@
else:
self.fail("where is my exception?")
- @skip_if_crdb("named cursor")
+ @skip_if_crdb("named cursor", version="< 22.1")
@skip_before_postgres(8, 2)
def test_named_with_noop(self):
with self.conn.cursor('named'):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psycopg2-2.9.3/tests/testutils.py new/psycopg2-2.9.5/tests/testutils.py
--- old/psycopg2-2.9.3/tests/testutils.py 2021-12-29 13:51:56.000000000 +0100
+++ new/psycopg2-2.9.5/tests/testutils.py 2022-10-25 13:05:48.000000000 +0200
@@ -467,11 +467,13 @@
crdb_reasons = {
"2-phase commit": 22329,
"backend pid": 35897,
+ "batch statements": 44803,
"cancel": 41335,
"cast adds tz": 51692,
"cidr": 18846,
"composite": 27792,
"copy": 41608,
+ "cursor with hold": 77101,
"deferrable": 48307,
"encoding": 35882,
"hstore": 41284,
@@ -483,6 +485,7 @@
"notify": 41522,
"password_encryption": 42519,
"range": 41282,
+ "scroll cursor": 77102,
"stored procedure": 1751,
}
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-pycapnp for openSUSE:Factory checked in at 2022-11-01 13:42:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pycapnp (Old)
and /work/SRC/openSUSE:Factory/.python-pycapnp.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pycapnp"
Tue Nov 1 13:42:12 2022 rev:3 rq:1032497 version:1.2.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pycapnp/python-pycapnp.changes 2022-10-08 01:25:30.610268900 +0200
+++ /work/SRC/openSUSE:Factory/.python-pycapnp.new.2275/python-pycapnp.changes 2022-11-01 13:42:22.671835320 +0100
@@ -1,0 +2,6 @@
+Fri Oct 28 20:02:46 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam(a)suse.com>
+
+- Update to v1.2.1
+ * Fix packaging for Apple Silicon
+
+-------------------------------------------------------------------
Old:
----
pycapnp-1.2.0.tar.gz
New:
----
pycapnp-1.2.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pycapnp.spec ++++++
--- /var/tmp/diff_new_pack.tauIPT/_old 2022-11-01 13:42:23.719840895 +0100
+++ /var/tmp/diff_new_pack.tauIPT/_new 2022-11-01 13:42:23.723840916 +0100
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-pycapnp
-Version: 1.2.0
+Version: 1.2.1
Release: 0
Summary: Cython wrapping of the C++ Cap'n Proto library
License: BSD-2-Clause
++++++ pycapnp-1.2.0.tar.gz -> pycapnp-1.2.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycapnp-1.2.0/.github/workflows/packagingtest.yml new/pycapnp-1.2.1/.github/workflows/packagingtest.yml
--- old/pycapnp-1.2.0/.github/workflows/packagingtest.yml 2022-08-29 10:13:39.000000000 +0200
+++ new/pycapnp-1.2.1/.github/workflows/packagingtest.yml 2022-09-12 08:08:45.000000000 +0200
@@ -40,6 +40,7 @@
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build pycapnp and install
+ if: matrix.arch == 'x86_64'
run: |
python setup.py build
pip install .
@@ -62,13 +63,17 @@
ARCHFLAGS: "-arch arm64" # python wheel
_PYTHON_HOST_PLATFORM: "macosx-11.0-arm64" # python wheel
run: |
- python setup.py bdist_wheel
+ env
+ rm -rf dist build build64 bundled
+ python setup.py bdist_wheel --force-bundled-libcapnp
+ ls -lh dist
python setup.py sdist
- uses: actions/upload-artifact(a)v1.0.0
with:
name: package_dist
path: dist
- name: Test with pytest
+ if: matrix.arch == 'x86_64'
run: |
pip install pytest
pytest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycapnp-1.2.0/CHANGELOG.md new/pycapnp-1.2.1/CHANGELOG.md
--- old/pycapnp-1.2.0/CHANGELOG.md 2022-08-29 10:13:39.000000000 +0200
+++ new/pycapnp-1.2.1/CHANGELOG.md 2022-09-12 08:08:45.000000000 +0200
@@ -1,3 +1,6 @@
+## v1.2.1 (2022-09-11)
+- Fix packaging for Apple Silicon
+
## v1.2.0 (2022-08-29)
- Added support for Apple Silicon
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycapnp-1.2.0/setup.py new/pycapnp-1.2.1/setup.py
--- old/pycapnp-1.2.0/setup.py 2022-08-29 10:13:39.000000000 +0200
+++ new/pycapnp-1.2.1/setup.py 2022-09-12 08:08:45.000000000 +0200
@@ -22,7 +22,7 @@
MAJOR = 1
MINOR = 2
-MICRO = 0
+MICRO = 1
TAG = ""
VERSION = "%d.%d.%d%s" % (MAJOR, MINOR, MICRO, TAG)
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-pymarc for openSUSE:Factory checked in at 2022-11-01 13:42:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pymarc (Old)
and /work/SRC/openSUSE:Factory/.python-pymarc.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pymarc"
Tue Nov 1 13:42:11 2022 rev:6 rq:1032494 version:4.2.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pymarc/python-pymarc.changes 2022-10-08 01:25:36.790283074 +0200
+++ /work/SRC/openSUSE:Factory/.python-pymarc.new.2275/python-pymarc.changes 2022-11-01 13:42:20.899825893 +0100
@@ -1,0 +2,7 @@
+Fri Oct 28 20:11:57 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam(a)suse.com>
+
+- Update to 4.2.1
+ * Bugfix for Field.delete_subfield() for situations when a subfield value is present with the name of the subfield that you want to delete.
+ * Updated README to point to ReadTheDocs documentation.
+
+-------------------------------------------------------------------
Old:
----
pymarc-4.2.0.tar.gz
New:
----
pymarc-4.2.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pymarc.spec ++++++
--- /var/tmp/diff_new_pack.hzDGsb/_old 2022-11-01 13:42:21.939831424 +0100
+++ /var/tmp/diff_new_pack.hzDGsb/_new 2022-11-01 13:42:21.943831446 +0100
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-pymarc
-Version: 4.2.0
+Version: 4.2.1
Release: 0
Summary: MARC bibliographic data manipulation module
License: BSD-2-Clause
++++++ pymarc-4.2.0.tar.gz -> pymarc-4.2.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymarc-4.2.0/PKG-INFO new/pymarc-4.2.1/PKG-INFO
--- old/pymarc-4.2.0/PKG-INFO 2022-04-05 00:46:29.947458500 +0200
+++ new/pymarc-4.2.1/PKG-INFO 2022-10-17 22:22:44.191717900 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pymarc
-Version: 4.2.0
+Version: 4.2.1
Summary: Read, write and modify MARC bibliographic data
Home-page: http://gitlab.com/pymarc/pymarc
Author: Ed Summers
@@ -44,6 +44,8 @@
you run across an example that you think should be here please send a
pull request.
+You can read pymarc documentation [here](https://pymarc.readthedocs.io/en/latest/).
+
### Installation
You'll probably just want to use pip to install pymarc:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymarc-4.2.0/README.md new/pymarc-4.2.1/README.md
--- old/pymarc-4.2.0/README.md 2022-03-02 23:15:58.000000000 +0100
+++ new/pymarc-4.2.1/README.md 2022-10-17 22:15:40.000000000 +0200
@@ -22,6 +22,8 @@
you run across an example that you think should be here please send a
pull request.
+You can read pymarc documentation [here](https://pymarc.readthedocs.io/en/latest/).
+
### Installation
You'll probably just want to use pip to install pymarc:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymarc-4.2.0/pymarc/field.py new/pymarc-4.2.1/pymarc/field.py
--- old/pymarc-4.2.0/pymarc/field.py 2022-04-05 00:40:47.000000000 +0200
+++ new/pymarc-4.2.1/pymarc/field.py 2022-10-17 22:15:40.000000000 +0200
@@ -190,13 +190,11 @@
If no subfield is found with the specified code None is returned.
"""
try:
- index = self.subfields.index(code)
- if index % 2 == 0:
- value = self.subfields.pop(index + 1)
- self.subfields.pop(index)
- return value
- else:
- return None
+ codes = self.subfields[0::2]
+ index = codes.index(code) * 2
+ value = self.subfields.pop(index + 1)
+ self.subfields.pop(index)
+ return value
except ValueError:
return None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymarc-4.2.0/pymarc.egg-info/PKG-INFO new/pymarc-4.2.1/pymarc.egg-info/PKG-INFO
--- old/pymarc-4.2.0/pymarc.egg-info/PKG-INFO 2022-04-05 00:46:29.000000000 +0200
+++ new/pymarc-4.2.1/pymarc.egg-info/PKG-INFO 2022-10-17 22:22:44.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pymarc
-Version: 4.2.0
+Version: 4.2.1
Summary: Read, write and modify MARC bibliographic data
Home-page: http://gitlab.com/pymarc/pymarc
Author: Ed Summers
@@ -44,6 +44,8 @@
you run across an example that you think should be here please send a
pull request.
+You can read pymarc documentation [here](https://pymarc.readthedocs.io/en/latest/).
+
### Installation
You'll probably just want to use pip to install pymarc:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymarc-4.2.0/setup.py new/pymarc-4.2.1/setup.py
--- old/pymarc-4.2.0/setup.py 2022-04-05 00:40:57.000000000 +0200
+++ new/pymarc-4.2.1/setup.py 2022-10-17 22:16:04.000000000 +0200
@@ -8,7 +8,7 @@
from setuptools import setup
-version = "4.2.0"
+version = "4.2.1"
classifiers = """
Intended Audience :: Education
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymarc-4.2.0/test/test_field.py new/pymarc-4.2.1/test/test_field.py
--- old/pymarc-4.2.0/test/test_field.py 2022-04-05 00:40:47.000000000 +0200
+++ new/pymarc-4.2.1/test/test_field.py 2022-10-17 22:15:40.000000000 +0200
@@ -171,10 +171,10 @@
self.assertEqual(self.field["a"], "changed")
def test_delete_subfield_only_by_code(self):
- self.field.delete_subfield("An American Odyssey")
- self.assertEqual(self.field["b"], "An American Odyssey")
- self.field.delete_subfield("b")
- self.assertTrue(self.field["b"] is None)
+ field = Field(tag="960", indicators=[" ", " "], subfields=["a", "b", "b", "x"])
+ value = field.delete_subfield("b")
+ self.assertEqual(value, "x")
+ self.assertEqual(field.subfields, ["a", "b"])
def test_subfield_dict(self):
field = Field(
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-typedload for openSUSE:Factory checked in at 2022-11-01 13:42:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-typedload (Old)
and /work/SRC/openSUSE:Factory/.python-typedload.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-typedload"
Tue Nov 1 13:42:10 2022 rev:3 rq:1032487 version:2.19
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-typedload/python-typedload.changes 2022-10-12 18:26:17.921902123 +0200
+++ /work/SRC/openSUSE:Factory/.python-typedload.new.2275/python-typedload.changes 2022-11-01 13:42:19.563818788 +0100
@@ -1,0 +2,12 @@
+Sat Oct 29 16:22:37 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam(a)suse.com>
+
+- Update to version 2.19
+ * Fix minor bug about exception raising from string constructed types
+ * Simplify type checking functions, defining only the one for the current python version
+ * Fix type definitions of some private functions for compatibility with cython
+ * Improved loading speed for dictionaries
+ * Improved loading speed for iterators
+ * Improved documentation
+ * Improved performance testing code
+
+-------------------------------------------------------------------
Old:
----
typedload_2.18.orig.tar.gz
typedload_2.18.orig.tar.gz.asc
New:
----
typedload_2.19.orig.tar.gz
typedload_2.19.orig.tar.gz.asc
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-typedload.spec ++++++
--- /var/tmp/diff_new_pack.OlLyal/_old 2022-11-01 13:42:20.083821553 +0100
+++ /var/tmp/diff_new_pack.OlLyal/_new 2022-11-01 13:42:20.087821574 +0100
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
Name: python-typedload
-Version: 2.18
+Version: 2.19
Release: 0
Summary: Load and dump data from json-like format into typed data structures
License: GPL-3.0-only
++++++ typedload_2.18.orig.tar.gz -> typedload_2.19.orig.tar.gz ++++++
++++ 6060 lines of diff (skipped)
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-DateTime for openSUSE:Factory checked in at 2022-11-01 13:42:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-DateTime (Old)
and /work/SRC/openSUSE:Factory/.python-DateTime.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-DateTime"
Tue Nov 1 13:42:09 2022 rev:4 rq:1032485 version:4.7
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-DateTime/python-DateTime.changes 2022-08-02 22:10:30.986001583 +0200
+++ /work/SRC/openSUSE:Factory/.python-DateTime.new.2275/python-DateTime.changes 2022-11-01 13:42:18.699814191 +0100
@@ -1,0 +2,12 @@
+Sat Oct 29 19:12:36 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam(a)suse.com>
+
+- Update to version 4.7:
+ * Fix rounding problem with DateTime addition beyond the year 2038 (#41)
+
+-------------------------------------------------------------------
+Tue Oct 11 23:16:05 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam(a)suse.com>
+
+- Update to version 4.6:
+ * Fix __format__ method for DateTime objects (#39)
+
+-------------------------------------------------------------------
Old:
----
DateTime-4.5.tar.gz
New:
----
DateTime-4.7.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-DateTime.spec ++++++
--- /var/tmp/diff_new_pack.AZbvVv/_old 2022-11-01 13:42:19.171816702 +0100
+++ /var/tmp/diff_new_pack.AZbvVv/_new 2022-11-01 13:42:19.179816744 +0100
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-DateTime
-Version: 4.5
+Version: 4.7
Release: 0
Summary: Zope DateTime data type
License: ZPL-2.1
++++++ DateTime-4.5.tar.gz -> DateTime-4.7.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DateTime-4.5/CHANGES.rst new/DateTime-4.7/CHANGES.rst
--- old/DateTime-4.5/CHANGES.rst 2022-07-04 08:31:17.000000000 +0200
+++ new/DateTime-4.7/CHANGES.rst 2022-09-14 08:29:54.000000000 +0200
@@ -1,6 +1,20 @@
Changelog
=========
+4.7 (2022-09-14)
+----------------
+
+- Fix rounding problem with `DateTime` addition beyond the year 2038
+ (`#41 <https://github.com/zopefoundation/DateTime/issues/41>`_)
+
+
+4.6 (2022-09-10)
+----------------
+
+- Fix ``__format__`` method for DateTime objects
+ (`#39 <https://github.com/zopefoundation/DateTime/issues/39>`_)
+
+
4.5 (2022-07-04)
----------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DateTime-4.5/PKG-INFO new/DateTime-4.7/PKG-INFO
--- old/DateTime-4.5/PKG-INFO 2022-07-04 08:31:19.719161000 +0200
+++ new/DateTime-4.7/PKG-INFO 2022-09-14 08:29:56.309736000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: DateTime
-Version: 4.5
+Version: 4.7
Summary: This package provides a DateTime data type, as known from Zope. Unless you need to communicate with Zope APIs, you're probably better off using Python's built-in datetime module.
Home-page: https://github.com/zopefoundation/DateTime
Author: Zope Foundation and Contributors
@@ -842,6 +842,20 @@
Changelog
=========
+4.7 (2022-09-14)
+----------------
+
+- Fix rounding problem with `DateTime` addition beyond the year 2038
+ (`#41 <https://github.com/zopefoundation/DateTime/issues/41>`_)
+
+
+4.6 (2022-09-10)
+----------------
+
+- Fix ``__format__`` method for DateTime objects
+ (`#39 <https://github.com/zopefoundation/DateTime/issues/39>`_)
+
+
4.5 (2022-07-04)
----------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DateTime-4.5/setup.py new/DateTime-4.7/setup.py
--- old/DateTime-4.5/setup.py 2022-07-04 08:31:17.000000000 +0200
+++ new/DateTime-4.7/setup.py 2022-09-14 08:29:54.000000000 +0200
@@ -26,7 +26,7 @@
with open(os.path.join(here, 'CHANGES.rst')) as f:
CHANGES = f.read()
-version = '4.5'
+version = '4.7'
setup(
name='DateTime',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DateTime-4.5/src/DateTime/DateTime.py new/DateTime-4.7/src/DateTime/DateTime.py
--- old/DateTime-4.5/src/DateTime/DateTime.py 2022-07-04 08:31:17.000000000 +0200
+++ new/DateTime-4.7/src/DateTime/DateTime.py 2022-09-14 08:29:54.000000000 +0200
@@ -864,7 +864,7 @@
# self._micros is the time since the epoch
# in long integer microseconds.
if microsecs is None:
- microsecs = long(math.floor(t * 1000000.0))
+ microsecs = long(round(t * 1000000.0))
self._micros = microsecs
def localZone(self, ltm=None):
@@ -1760,7 +1760,7 @@
x = _calcDependentSecond(tz, t)
yr, mo, dy, hr, mn, sc = _calcYMDHMS(x, ms)
return self.__class__(yr, mo, dy, hr, mn, sc, self._tz,
- t, d, s, None, self.timezoneNaive())
+ t, d, s, tmicros, self.timezoneNaive())
__radd__ = __add__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DateTime-4.5/src/DateTime/tests/test_datetime.py new/DateTime-4.7/src/DateTime/tests/test_datetime.py
--- old/DateTime-4.5/src/DateTime/tests/test_datetime.py 2022-07-04 08:31:17.000000000 +0200
+++ new/DateTime-4.7/src/DateTime/tests/test_datetime.py 2022-09-14 08:29:54.000000000 +0200
@@ -103,6 +103,16 @@
dt = DateTime()
self.assertEqual(str(dt + 0.10 + 3.14 + 6.76 - 10), str(dt),
dt)
+ # checks problem reported in
+ # https://github.com/zopefoundation/DateTime/issues/41
+ dt = DateTime(2038, 10, 7, 8, 52, 44.959840, "UTC")
+ self.assertEqual(str(dt + 0.10 + 3.14 + 6.76 - 10), str(dt),
+ dt)
+
+ def testConsistentSecondMicroRounding(self):
+ dt = DateTime(2038, 10, 7, 8, 52, 44.9598398, "UTC")
+ self.assertEqual(int(dt.second() * 1000000),
+ dt.micros() % 60000000)
def testConstructor3(self):
# Constructor from date/time string
@@ -686,10 +696,10 @@
@unittest.skipUnless(PY3K, 'format method is Python 3 only')
def test_format(self):
dt = DateTime(1968, 3, 10, 23, 45, 0, 'Europe/Vienna')
- fmt = '%-d.%-m.%Y %H:%M'
+ fmt = '%d.%m.%Y %H:%M'
result = dt.strftime(fmt)
unformatted_result = '1968/03/10 23:45:00 Europe/Vienna'
- self.assertEqual(result, '{:%-d.%-m.%Y %H:%M}'.format(dt))
+ self.assertEqual(result, '{:%d.%m.%Y %H:%M}'.format(dt))
self.assertEqual(unformatted_result, '{:}'.format(dt))
self.assertEqual(unformatted_result, '{}'.format(dt))
eval("self.assertEqual(result, f'{dt:{fmt}}')")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DateTime-4.5/src/DateTime.egg-info/PKG-INFO new/DateTime-4.7/src/DateTime.egg-info/PKG-INFO
--- old/DateTime-4.5/src/DateTime.egg-info/PKG-INFO 2022-07-04 08:31:19.000000000 +0200
+++ new/DateTime-4.7/src/DateTime.egg-info/PKG-INFO 2022-09-14 08:29:55.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: DateTime
-Version: 4.5
+Version: 4.7
Summary: This package provides a DateTime data type, as known from Zope. Unless you need to communicate with Zope APIs, you're probably better off using Python's built-in datetime module.
Home-page: https://github.com/zopefoundation/DateTime
Author: Zope Foundation and Contributors
@@ -842,6 +842,20 @@
Changelog
=========
+4.7 (2022-09-14)
+----------------
+
+- Fix rounding problem with `DateTime` addition beyond the year 2038
+ (`#41 <https://github.com/zopefoundation/DateTime/issues/41>`_)
+
+
+4.6 (2022-09-10)
+----------------
+
+- Fix ``__format__`` method for DateTime objects
+ (`#39 <https://github.com/zopefoundation/DateTime/issues/39>`_)
+
+
4.5 (2022-07-04)
----------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DateTime-4.5/tox.ini new/DateTime-4.7/tox.ini
--- old/DateTime-4.5/tox.ini 2022-07-04 08:31:17.000000000 +0200
+++ new/DateTime-4.7/tox.ini 2022-09-14 08:29:54.000000000 +0200
@@ -17,16 +17,14 @@
[testenv]
skip_install = true
-# We need to pin setuptools < 60 until zc.buildout 3.x supports it.
deps =
- setuptools < 60
- zc.buildout==3.0.0rc2
+ zc.buildout >= 3.0.0rc3
wheel > 0.37
commands_pre =
py27,py35: {envbindir}/buildout -nc {toxinidir}/buildout4.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
!py27-!py35: {envbindir}/buildout -nc {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
commands =
- {envbindir}/test {posargs:-cv}
+ {envdir}/bin/test {posargs:-cv}
[testenv:lint]
basepython = python3
@@ -69,7 +67,7 @@
coverage-python-version
commands =
mkdir -p {toxinidir}/parts/htmlcov
- coverage run {envbindir}/test {posargs:-cv}
+ coverage run {envdir}/bin/test {posargs:-cv}
coverage html
coverage report -m --fail-under=88
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-flake8-debugger for openSUSE:Factory checked in at 2022-11-01 13:42:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-flake8-debugger (Old)
and /work/SRC/openSUSE:Factory/.python-flake8-debugger.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-flake8-debugger"
Tue Nov 1 13:42:08 2022 rev:4 rq:1032481 version:4.1.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-flake8-debugger/python-flake8-debugger.changes 2021-04-01 14:19:32.376174149 +0200
+++ /work/SRC/openSUSE:Factory/.python-flake8-debugger.new.2275/python-flake8-debugger.changes 2022-11-01 13:42:17.647808594 +0100
@@ -1,0 +2,13 @@
+Wed Oct 12 03:20:30 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam(a)suse.com>
+
+- Update to version 4.1.2
+ * Add tests to bundle.
+
+- Update to version 4.1.1
+ * Add tests to bundle.
+
+- Update to version 4.1.0
+ * Drop support for python 3.6 and remove special handling code.
+ * bundle licence file.
+
+-------------------------------------------------------------------
Old:
----
flake8-debugger-4.0.0.tar.gz
New:
----
flake8-debugger-4.1.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-flake8-debugger.spec ++++++
--- /var/tmp/diff_new_pack.OT5Sgx/_old 2022-11-01 13:42:18.111811063 +0100
+++ /var/tmp/diff_new_pack.OT5Sgx/_new 2022-11-01 13:42:18.115811084 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-flake8-debugger
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%global skip_python2 1
Name: python-flake8-debugger
-Version: 4.0.0
+Version: 4.1.2
Release: 0
Summary: ipdb/pdb statement checker plugin for flake8
License: MIT
++++++ flake8-debugger-4.0.0.tar.gz -> flake8-debugger-4.1.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-debugger-4.0.0/LICENCE new/flake8-debugger-4.1.2/LICENCE
--- old/flake8-debugger-4.0.0/LICENCE 1970-01-01 01:00:00.000000000 +0100
+++ new/flake8-debugger-4.1.2/LICENCE 2022-04-30 18:32:47.135803200 +0200
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2016 Joseph Kahn
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-debugger-4.0.0/PKG-INFO new/flake8-debugger-4.1.2/PKG-INFO
--- old/flake8-debugger-4.0.0/PKG-INFO 2020-11-29 15:34:40.869482000 +0100
+++ new/flake8-debugger-4.1.2/PKG-INFO 2022-04-30 18:50:47.868120000 +0200
@@ -1,13 +1,13 @@
Metadata-Version: 2.1
Name: flake8-debugger
-Version: 4.0.0
+Version: 4.1.2
Summary: ipdb/pdb statement checker plugin for flake8
Home-page: https://github.com/jbkahn/flake8-debugger
License: MIT
Keywords: flake8,plugin,linting,debugger,ipdb,code quality
Author: Joseph Kahn
Author-email: josephbkahn(a)gmail.com
-Requires-Python: >=3.6
+Requires-Python: >=3.7
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Framework :: Flake8
@@ -17,7 +17,6 @@
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
@@ -25,7 +24,6 @@
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Dist: flake8 (>=3.0)
Requires-Dist: pycodestyle
-Requires-Dist: six
Project-URL: Repository, https://github.com/jbkahn/flake8-debugger
Description-Content-Type: text/markdown
@@ -59,6 +57,19 @@
Changes
-------
+##### 4.1.2 - 2022-04-30
+
+* Add tests to bundle.
+
+##### 4.1.1 - 2022-04-30
+
+* Add tests to bundle.
+
+##### 4.1.0 - 2022-04-30
+
+* Drop support for python 3.6 and remove special handling code.
+* bundle licence file.
+
##### 4.0.0 - 2020-11-29
* Opted back into using Poetry now that the existing issues have been fixed.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-debugger-4.0.0/README.md new/flake8-debugger-4.1.2/README.md
--- old/flake8-debugger-4.0.0/README.md 2020-11-29 15:34:24.106767200 +0100
+++ new/flake8-debugger-4.1.2/README.md 2022-04-30 18:47:22.242065200 +0200
@@ -28,6 +28,19 @@
Changes
-------
+##### 4.1.2 - 2022-04-30
+
+* Add tests to bundle.
+
+##### 4.1.1 - 2022-04-30
+
+* Add tests to bundle.
+
+##### 4.1.0 - 2022-04-30
+
+* Drop support for python 3.6 and remove special handling code.
+* bundle licence file.
+
##### 4.0.0 - 2020-11-29
* Opted back into using Poetry now that the existing issues have been fixed.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-debugger-4.0.0/flake8_debugger.py new/flake8-debugger-4.1.2/flake8_debugger.py
--- old/flake8-debugger-4.0.0/flake8_debugger.py 2020-11-29 15:34:24.107055400 +0100
+++ new/flake8-debugger-4.1.2/flake8_debugger.py 2022-04-30 18:47:17.872095000 +0200
@@ -1,6 +1,5 @@
"""Extension for flake8 that finds usage of the debugger."""
import ast
-import sys
from itertools import chain
import pycodestyle
@@ -10,7 +9,7 @@
except ImportError:
from flake8 import utils as stdin_utils
-__version__ = "4.0.0"
+__version__ = "4.1.2"
DEBUGGER_ERROR_CODE = "T100"
@@ -20,11 +19,10 @@
"ipdb": ["set_trace", "sset_trace"],
"IPython.terminal.embed": ["InteractiveShellEmbed"],
"IPython.frontend.terminal.embed": ["InteractiveShellEmbed"],
+ "celery.contrib.rdb": ["set_trace"],
+ "builtins": ["breakpoint"]
}
-if sys.version_info >= (3, 7):
- debuggers["builtins"] = ["breakpoint"]
-
class DebuggerFinder(ast.NodeVisitor):
def __init__(self, *args, **kwargs):
@@ -38,7 +36,7 @@
self.debuggers_imported = {}
def visit_Call(self, node):
- if sys.version_info >= (3, 7) and getattr(node.func, "id", None) == "breakpoint":
+ if getattr(node.func, "id", None) == "breakpoint":
entry = self.debuggers_used.setdefault((node.lineno, node.col_offset), [])
entry.append("{0} trace found: breakpoint used".format(DEBUGGER_ERROR_CODE))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-debugger-4.0.0/pyproject.toml new/flake8-debugger-4.1.2/pyproject.toml
--- old/flake8-debugger-4.0.0/pyproject.toml 2020-11-29 15:34:24.107966200 +0100
+++ new/flake8-debugger-4.1.2/pyproject.toml 2022-04-30 18:49:10.991401000 +0200
@@ -4,7 +4,7 @@
[tool.poetry]
name = "flake8-debugger"
-version = "4.0.0"
+version = "4.1.2"
description = "ipdb/pdb statement checker plugin for flake8"
readme = "README.md"
@@ -40,24 +40,23 @@
]
-include = ["pyproject.toml", "flake8_debugger.py"]
+include = ["pyproject.toml", "flake8_debugger.py", "LICENCE", "test_linter.py"]
[tool.poetry.plugins."flake8.extension"]
T100 = "flake8_debugger:DebuggerChecker"
[tool.poetry.dependencies]
-python = ">=3.6"
+python = ">=3.7"
"flake8" = ">=3.0"
-six = "*"
pycodestyle = "*"
[tool.poetry.dev-dependencies]
-black = { version = "^20.8b1" }
+black = { version = "^22.3.0" }
pytest = "*"
[tool.black]
line-length = 120
-target-version = ['py36', 'py37', 'py38', 'py39']
+target-version = ['py37', 'py38', 'py39', 'py310']
include = '\.pyi?$'
exclude = '''
/(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-debugger-4.0.0/setup.py new/flake8-debugger-4.1.2/setup.py
--- old/flake8-debugger-4.0.0/setup.py 2020-11-29 15:34:40.869191000 +0100
+++ new/flake8-debugger-4.1.2/setup.py 2022-04-30 18:50:47.867723000 +0200
@@ -4,16 +4,16 @@
modules = \
['flake8_debugger']
install_requires = \
-['flake8>=3.0', 'pycodestyle', 'six']
+['flake8>=3.0', 'pycodestyle']
entry_points = \
{'flake8.extension': ['T100 = flake8_debugger:DebuggerChecker']}
setup_kwargs = {
'name': 'flake8-debugger',
- 'version': '4.0.0',
+ 'version': '4.1.2',
'description': 'ipdb/pdb statement checker plugin for flake8',
- 'long_description': 'Flake8 debugger plugin\n======================\n\nCheck for pdb;idbp imports and set traces, as well as `from IPython.terminal.embed import InteractiveShellEmbed` and `InteractiveShellEmbed()()`.\n\nThis module provides a plugin for ``flake8``, the Python code checker.\n\n\nInstallation\n------------\n\nYou can install or upgrade ``flake8-debugger`` with these commands::\n\n $ pip install flake8-debugger\n $ pip install --upgrade flake8-debugger\n\n\nPlugin for Flake8\n-----------------\n\nWhen both ``flake8 2.2`` and ``flake8-debugger`` are installed, the plugin is\navailable in ``flake8``::\n\n $ flake8 --version\n 2.0 (pep8: 1.4.5, flake8-debugger: 1.0, pyflakes: 0.6.1)\n\n\nChanges\n-------\n\n##### 4.0.0 - 2020-11-29\n\n* Opted back into using Poetry now that the existing issues have been fixed.\n* Python 2.7 support was no officially dropped.\n\n##### 3.2.1 - 2019-10-31\n\n* Swapped back from poetry to setup.py :(....python ecosystem issues
....\n\n##### 3.2.0 - 2019-10-15\n\n* Forgot to add `breakpoint` support to the last changelog entry as well as fixing a bug introduced into that version that flagged `import builtins` as noteworthy.\n\n\n##### 3.1.1 - 2019-10-12\n\n* Fix reading from stdin when it is closed (requires flake8 > 2.1).\n* Swapped to poetry from setup.py\n* Ran black on the repository\n\n##### 3.1.0 - 2018-02-11\n* Add a framework classifier for use in pypi.org\n* Fix entry_point in setup.py leaving it off by default again\n* Detect __import__ debugger statements\n* Add support for `pudb` detection\n\n##### 3.0.0 - 2017-05-11\n* fix the refactor of the detector in 2.0.0 that was removed from pypi.\n* fix a flake8 issue that had it turned off by default.\n\n\n##### 2.0.0 - 2016-09-19\n* refactor detector\n* drop official support for python 2.6 and 3.3\n\n\n##### 1.4.0 - 2015-05-18\n* refactor detector, run tests in python 2.6, 2.7 and 3.4 as well as adding a check for InteractiveShellEmbed.\n\n##### 1.3.
2 - 2014-11-04\n* more tests, fix edge case and debugger identification.\n\n##### 1.3.1 - 2014-11-04\n* more tests, a little refactoring and improvements in catching.\n\n##### 1.3 - 2014-11-04\n* using ast instead of regular expressions\n\n##### 1.2 - 2014-06-30\n* Added a few simple tests\n\n##### 1.1 - 2014-06-30\n* First release\n\n##### 1.0 - 2014-06-30\n* Whoops\n',
+ 'long_description': 'Flake8 debugger plugin\n======================\n\nCheck for pdb;idbp imports and set traces, as well as `from IPython.terminal.embed import InteractiveShellEmbed` and `InteractiveShellEmbed()()`.\n\nThis module provides a plugin for ``flake8``, the Python code checker.\n\n\nInstallation\n------------\n\nYou can install or upgrade ``flake8-debugger`` with these commands::\n\n $ pip install flake8-debugger\n $ pip install --upgrade flake8-debugger\n\n\nPlugin for Flake8\n-----------------\n\nWhen both ``flake8 2.2`` and ``flake8-debugger`` are installed, the plugin is\navailable in ``flake8``::\n\n $ flake8 --version\n 2.0 (pep8: 1.4.5, flake8-debugger: 1.0, pyflakes: 0.6.1)\n\n\nChanges\n-------\n\n##### 4.1.2 - 2022-04-30\n\n* Add tests to bundle.\n\n##### 4.1.1 - 2022-04-30\n\n* Add tests to bundle.\n\n##### 4.1.0 - 2022-04-30\n\n* Drop support for python 3.6 and remove special handling code.\n* bundle licence file.\n\n##### 4.0.0 - 2020-11-29\n
\n* Opted back into using Poetry now that the existing issues have been fixed.\n* Python 2.7 support was no officially dropped.\n\n##### 3.2.1 - 2019-10-31\n\n* Swapped back from poetry to setup.py :(....python ecosystem issues....\n\n##### 3.2.0 - 2019-10-15\n\n* Forgot to add `breakpoint` support to the last changelog entry as well as fixing a bug introduced into that version that flagged `import builtins` as noteworthy.\n\n\n##### 3.1.1 - 2019-10-12\n\n* Fix reading from stdin when it is closed (requires flake8 > 2.1).\n* Swapped to poetry from setup.py\n* Ran black on the repository\n\n##### 3.1.0 - 2018-02-11\n* Add a framework classifier for use in pypi.org\n* Fix entry_point in setup.py leaving it off by default again\n* Detect __import__ debugger statements\n* Add support for `pudb` detection\n\n##### 3.0.0 - 2017-05-11\n* fix the refactor of the detector in 2.0.0 that was removed from pypi.\n* fix a flake8 issue that had it turned off by default.\n\n\n##### 2.0.0 - 2016-09-
19\n* refactor detector\n* drop official support for python 2.6 and 3.3\n\n\n##### 1.4.0 - 2015-05-18\n* refactor detector, run tests in python 2.6, 2.7 and 3.4 as well as adding a check for InteractiveShellEmbed.\n\n##### 1.3.2 - 2014-11-04\n* more tests, fix edge case and debugger identification.\n\n##### 1.3.1 - 2014-11-04\n* more tests, a little refactoring and improvements in catching.\n\n##### 1.3 - 2014-11-04\n* using ast instead of regular expressions\n\n##### 1.2 - 2014-06-30\n* Added a few simple tests\n\n##### 1.1 - 2014-06-30\n* First release\n\n##### 1.0 - 2014-06-30\n* Whoops\n',
'author': 'Joseph Kahn',
'author_email': 'josephbkahn(a)gmail.com',
'maintainer': None,
@@ -22,7 +22,7 @@
'py_modules': modules,
'install_requires': install_requires,
'entry_points': entry_points,
- 'python_requires': '>=3.6',
+ 'python_requires': '>=3.7',
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flake8-debugger-4.0.0/test_linter.py new/flake8-debugger-4.1.2/test_linter.py
--- old/flake8-debugger-4.0.0/test_linter.py 1970-01-01 01:00:00.000000000 +0100
+++ new/flake8-debugger-4.1.2/test_linter.py 2022-04-30 18:32:47.137562000 +0200
@@ -0,0 +1,415 @@
+import pycodestyle
+
+from flake8_debugger import DebuggerChecker
+
+import pytest
+
+
+class CaptureReport(pycodestyle.BaseReport):
+ """Collect the results of the checks."""
+
+ def __init__(self, options):
+ self._results = []
+ super(CaptureReport, self).__init__(options)
+
+ def error(self, line_number, offset, text, check):
+ """Store each error."""
+ code = super(CaptureReport, self).error(line_number, offset, text, check)
+ if code:
+ record = {"line": line_number, "col": offset, "message": "{0} {1}".format(code, text[5:])}
+ self._results.append(record)
+ return code
+
+
+class DebuggerTestStyleGuide(pycodestyle.StyleGuide):
+
+ logical_checks = []
+ physical_checks = []
+ ast_checks = [("debugger_usage", DebuggerChecker, ["tree", "filename", "lines"])]
+ max_line_length = None
+ max_doc_length = None
+ hang_closing = False
+ verbose = False
+ benchmark_keys = {"files": 0, "physical lines": 0, "logical lines": 0}
+ indent_size = 4
+
+
+_debugger_test_style = DebuggerTestStyleGuide()
+
+
+def check_code_for_debugger_statements(code):
+ """Process code using pycodestyle Checker and return all errors."""
+ from tempfile import NamedTemporaryFile
+
+ test_file = NamedTemporaryFile(delete=False)
+ test_file.write(code.encode())
+ test_file.flush()
+ report = CaptureReport(options=_debugger_test_style)
+ lines = [line + "\n" for line in code.split("\n")]
+ checker = pycodestyle.Checker(filename=test_file.name, lines=lines, options=_debugger_test_style, report=report)
+
+ checker.check_all()
+ return report._results
+
+
+class TestQA(object):
+ def test_catches_simple_debugger(self):
+ result = check_code_for_debugger_statements("from ipdb import set_trace as r\nr()")
+
+ expected_result = [
+ {"line": 2, "message": "T100 trace found: set_trace used as r", "col": 0},
+ {"line": 1, "message": "T100 import for set_trace found as r", "col": 0},
+ ]
+
+ assert result == expected_result
+
+ def test_catches_simple_debugger_when_called_off_lib(self):
+ result = check_code_for_debugger_statements("import ipdb\nipdb.set_trace()")
+
+ expected_result = [
+ {"line": 2, "message": "T100 trace found: ipdb.set_trace used", "col": 0},
+ {"line": 1, "message": "T100 import for ipdb found", "col": 0},
+ ]
+
+ assert result == expected_result
+
+ def test_catches_simple_debugger_when_called_off_global(self):
+ result = check_code_for_debugger_statements("__import__('ipdb').set_trace()")
+
+ expected_result = [{"line": 1, "message": "T100 trace found: set_trace used", "col": 0}]
+
+ assert result == expected_result
+
+ @pytest.mark.skipif(True, reason="Not supported just yet")
+ def test_catches_simple_debugger_when_called_off_var(self):
+ result = check_code_for_debugger_statements("import ipdb\ntest = ipdb.set_trace\ntest()")
+
+ expected_result = [
+ {"line": 1, "message": "T100 import for ipdb found", "col": 0},
+ {"line": 3, "message": "T100 trace found: ipdb.set_trace used", "col": 0},
+ ]
+ assert result == expected_result
+
+
+class TestBreakpoint(object):
+ def test_catches_breakpoint_call_for_python_3_7_and_above(self):
+ result = check_code_for_debugger_statements("breakpoint()")
+
+ expected_result = [{"line": 1, "message": "T100 trace found: breakpoint used", "col": 0}]
+
+ assert result == expected_result
+
+ def test_catches_breakpoint_import(self):
+ result = check_code_for_debugger_statements("from builtins import breakpoint")
+
+ expected_result = [{"line": 1, "message": "T100 import for breakpoint found", "col": 0}]
+
+ assert result == expected_result
+
+ def test_allows_builtins_import(self):
+ result = check_code_for_debugger_statements("import builtins")
+
+ expected_result = []
+
+ assert result == expected_result
+
+ def test_catches_breakpoint_usage_from_builtins(self):
+ result = check_code_for_debugger_statements("import builtins\nbuiltins.breakpoint()")
+
+ expected_result = [{"col": 0, "line": 2, "message": "T100 trace found: breakpoint used"}]
+
+ assert result == expected_result
+
+ def test_catches_breakpoint_imported_as_other_name(self):
+ result = check_code_for_debugger_statements("from builtins import breakpoint as b\nb()")
+
+ expected_result = [
+ {"line": 2, "message": "T100 trace found: breakpoint used as b", "col": 0},
+ {"line": 1, "message": "T100 import for breakpoint found as b", "col": 0},
+ ]
+
+ assert result == expected_result
+
+
+class TestNoQA(object):
+ def test_skip_import(self):
+ result = check_code_for_debugger_statements("from ipdb import set_trace as r # noqa\nr()")
+
+ expected_result = [{"line": 2, "message": "T100 trace found: set_trace used as r", "col": 0}]
+
+ assert result == expected_result
+
+ def test_skip_usage(self):
+ result = check_code_for_debugger_statements("from ipdb import set_trace as r\nr() # noqa")
+
+ expected_result = [{"line": 1, "message": "T100 import for set_trace found as r", "col": 0}]
+
+ assert result == expected_result
+
+ def test_skip_import_and_usage(self):
+ result = check_code_for_debugger_statements("from ipdb import set_trace as r # noqa\nr() # noqa")
+
+ expected_result = []
+
+ assert result == expected_result
+
+
+class TestImportCases(object):
+ def test_import_multiple(self):
+ result = check_code_for_debugger_statements("import math, ipdb, collections")
+ assert result == [{"col": 0, "line": 1, "message": "T100 import for ipdb found"}]
+
+ def test_import(self):
+ result = check_code_for_debugger_statements("import pdb")
+ assert result == [{"col": 0, "line": 1, "message": "T100 import for pdb found"}]
+
+ def test_import_interactive_shell_embed(self):
+ result = check_code_for_debugger_statements("from IPython.terminal.embed import InteractiveShellEmbed")
+ assert result == [{"col": 0, "line": 1, "message": "T100 import for InteractiveShellEmbed found"}]
+
+ def test_import_both_same_line(self):
+ result = check_code_for_debugger_statements("import pdb, ipdb")
+ result = sorted(result, key=lambda debugger: debugger["message"])
+ expected_result = [
+ {"col": 0, "line": 1, "message": "T100 import for ipdb found"},
+ {"col": 0, "line": 1, "message": "T100 import for pdb found"},
+ ]
+ assert result == expected_result
+
+ def test_import_math(self):
+ result = check_code_for_debugger_statements("import math")
+ assert result == []
+
+ def test_import_noqa(self):
+ result = check_code_for_debugger_statements("import ipdb # noqa")
+ assert result == []
+
+
+class TestModuleSetTraceCases(object):
+ def test_import_ipython_terminal_embed_use_InteractiveShellEmbed(self):
+ result = check_code_for_debugger_statements(
+ "from IPython.terminal.embed import InteractiveShellEmbed; InteractiveShellEmbed()()"
+ )
+
+ expected_result = [
+ {"col": 58, "line": 1, "message": "T100 trace found: InteractiveShellEmbed used"},
+ {"col": 0, "line": 1, "message": "T100 import for InteractiveShellEmbed found"},
+ ]
+
+ try:
+ assert result == expected_result
+ except AssertionError:
+ for item in expected_result:
+ item["col"] = 0
+
+ assert result == expected_result
+
+ def test_import_ipdb_use_set_trace(self):
+ result = check_code_for_debugger_statements("import ipdb;ipdb.set_trace();")
+
+ expected_result = [
+ {"col": 12, "line": 1, "message": "T100 trace found: ipdb.set_trace used"},
+ {"col": 0, "line": 1, "message": "T100 import for ipdb found"},
+ ]
+
+ try:
+ assert result == expected_result
+ except AssertionError:
+ for item in expected_result:
+ item["col"] = 0
+
+ assert result == expected_result
+
+ def test_import_pdb_use_set_trace(self):
+ result = check_code_for_debugger_statements("import pdb;pdb.set_trace();")
+
+ expected_result = [
+ {"col": 11, "line": 1, "message": "T100 trace found: pdb.set_trace used"},
+ {"col": 0, "line": 1, "message": "T100 import for pdb found"},
+ ]
+
+ try:
+ assert result == expected_result
+ except AssertionError:
+ for item in expected_result:
+ item["col"] = 0
+
+ assert result == expected_result
+
+ def test_import_pdb_use_set_trace_twice(self):
+ result = check_code_for_debugger_statements("import pdb;pdb.set_trace() and pdb.set_trace();")
+
+ expected_result = [
+ {"col": 11, "line": 1, "message": "T100 trace found: pdb.set_trace used"},
+ {"col": 31, "line": 1, "message": "T100 trace found: pdb.set_trace used"},
+ {"col": 0, "line": 1, "message": "T100 import for pdb found"},
+ ]
+
+ try:
+ assert result == expected_result
+ except AssertionError:
+ for item in expected_result:
+ item["col"] = 0
+
+ assert result == expected_result
+
+ def test_import_other_module_as_set_trace_and_use_it(self):
+ result = check_code_for_debugger_statements("from math import Max as set_trace\nset_trace()")
+ assert result == []
+
+ def test_import_rdb_use_set_trace(self):
+ result = check_code_for_debugger_statements("from celery.contrib import rdb;rdb.set_trace();")
+
+ expected_result = [
+ {"col": 31, "line": 1, "message": "T100 trace found: set_trace used"},
+ ]
+
+ try:
+ assert result == expected_result
+ except AssertionError:
+ for item in expected_result:
+ item["col"] = 0
+
+ assert result == expected_result
+
+ def test_from_celery_import_rdb_use_set_trace(self):
+ result = check_code_for_debugger_statements("import celery.contrib.rdb;celery.contrib.rdb.set_trace();")
+
+ expected_result = [
+ {"col": 26, "line": 1, "message": "T100 trace found: set_trace used"},
+ {"col": 0, "line": 1, "message": "T100 import for celery.contrib.rdb found"},
+ ]
+
+ try:
+ assert result == expected_result
+ except AssertionError:
+ for item in expected_result:
+ item["col"] = 0
+
+ assert result == expected_result
+
+
+class TestImportAsCases(object):
+ def test_import_ipdb_as(self):
+ result = check_code_for_debugger_statements("import math, ipdb as sif, collections")
+ assert result == [{"col": 0, "line": 1, "message": "T100 import for ipdb found as sif"}]
+
+
+class TestModuleASSetTraceCases(object):
+ def test_import_ipdb_as_use_set_trace(self):
+ result = check_code_for_debugger_statements("import ipdb as sif;sif.set_trace();")
+
+ expected_result = [
+ {"col": 19, "line": 1, "message": "T100 trace found: sif.set_trace used"},
+ {"col": 0, "line": 1, "message": "T100 import for ipdb found as sif"},
+ ]
+
+ try:
+ assert result == expected_result
+ except AssertionError:
+ for item in expected_result:
+ item["col"] = 0
+
+ assert result == expected_result
+
+
+class TestImportSetTraceCases(object):
+ def test_import_set_trace_ipdb(self):
+ result = check_code_for_debugger_statements("from ipdb import run, set_trace;set_trace();")
+
+ expected_result = [
+ {"col": 32, "line": 1, "message": "T100 trace found: set_trace used"},
+ {"col": 0, "line": 1, "message": "T100 import for set_trace found"},
+ ]
+
+ try:
+ assert result == expected_result
+ except AssertionError:
+ for item in expected_result:
+ item["col"] = 0
+
+ assert result == expected_result
+
+ def test_import_set_trace_pdb(self):
+ result = check_code_for_debugger_statements("from pdb import set_trace; set_trace();")
+
+ expected_result = [
+ {"col": 27, "line": 1, "message": "T100 trace found: set_trace used"},
+ {"col": 0, "line": 1, "message": "T100 import for set_trace found"},
+ ]
+
+ try:
+ assert result == expected_result
+ except AssertionError:
+ for item in expected_result:
+ item["col"] = 0
+
+ assert result == expected_result
+
+ def test_import_set_trace_ipdb_as_and_use(self):
+ result = check_code_for_debugger_statements("from ipdb import run, set_trace as sif; sif();")
+
+ expected_result = [
+ {"col": 40, "line": 1, "message": "T100 trace found: set_trace used as sif"},
+ {"col": 0, "line": 1, "message": "T100 import for set_trace found as sif"},
+ ]
+
+ try:
+ assert result == expected_result
+ except AssertionError:
+ for item in expected_result:
+ item["col"] = 0
+
+ assert result == expected_result
+
+ def test_import_set_trace_ipdb_as_and_use_with_conjunction_and(self):
+ result = check_code_for_debugger_statements("from ipdb import run, set_trace as sif; True and sif();")
+
+ expected_result = [
+ {"col": 49, "line": 1, "message": "T100 trace found: set_trace used as sif"},
+ {"col": 0, "line": 1, "message": "T100 import for set_trace found as sif"},
+ ]
+
+ try:
+ assert result == expected_result
+ except AssertionError:
+ for item in expected_result:
+ item["col"] = 0
+
+ assert result == expected_result
+
+ def test_import_set_trace_ipdb_as_and_use_with_conjunction_or(self):
+ result = check_code_for_debugger_statements("from ipdb import run, set_trace as sif; True or sif();")
+
+ expected_result = [
+ {"col": 48, "line": 1, "message": "T100 trace found: set_trace used as sif"},
+ {"col": 0, "line": 1, "message": "T100 import for set_trace found as sif"},
+ ]
+
+ try:
+ assert result == expected_result
+ except AssertionError:
+ for item in expected_result:
+ item["col"] = 0
+
+ assert result == expected_result
+
+ def test_import_set_trace_ipdb_as_and_use_with_conjunction_or_noqa(self):
+ result = check_code_for_debugger_statements("from ipdb import run, set_trace as sif; True or sif(); # noqa")
+ try:
+ assert result == []
+ except AssertionError:
+ pass
+
+ def test_import_set_trace_ipdb_as_and_use_with_conjunction_or_noqa_import_only(self):
+ result = check_code_for_debugger_statements("from ipdb import run, set_trace as sif # noqa\nTrue or sif()")
+
+ expected_result = [{"col": 8, "line": 2, "message": "T100 trace found: set_trace used as sif"}]
+
+ try:
+ assert result == expected_result
+ except AssertionError:
+ for item in expected_result:
+ item["col"] = 0
+
+ assert result == expected_result
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-sphinxext-opengraph for openSUSE:Factory checked in at 2022-11-01 13:42:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-sphinxext-opengraph (Old)
and /work/SRC/openSUSE:Factory/.python-sphinxext-opengraph.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-sphinxext-opengraph"
Tue Nov 1 13:42:07 2022 rev:2 rq:1032480 version:0.6.3
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-sphinxext-opengraph/python-sphinxext-opengraph.changes 2021-09-17 23:26:28.793264449 +0200
+++ /work/SRC/openSUSE:Factory/.python-sphinxext-opengraph.new.2275/python-sphinxext-opengraph.changes 2022-11-01 13:42:16.455802253 +0100
@@ -1,0 +2,24 @@
+Tue Oct 11 15:31:19 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam(a)suse.com>
+
+- Update to version 0.6.3
+ Fix first_image not resolving correctly when in subdirectories and ogp_image is defined. by @ItayZiv in #63
+
+- Update to version 0.6.2
+ chore(README) Typo fix by @tony in #58
+ Fix first_image not resolving correctly in subdirectories by @ItayZiv in #61
+
+- Update to version 0.6.1
+ fix og:url for "dirhtml" builder by @ru-fu in #54
+
+- Update to version 0.6.0
+ Include license in setup.py by @sciencewhiz in #52
+ Add per-file overrides using field lists by @ItayZiv in #50
+
+- Update to version 0.5.1
+ Escape quotations in Open Graph description when smart quotes are disabled. by @ItayZiv in #49
+
+- Update to version 0.5.0
+ Skipping code blocks and fixing docs build. by @Robpol86 in #47
+ Convert relative paths to absolute in og:image. by @Robpol86 in #48
+
+-------------------------------------------------------------------
Old:
----
sphinxext-opengraph-0.4.2.tar.gz
New:
----
sphinxext-opengraph-0.6.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-sphinxext-opengraph.spec ++++++
--- /var/tmp/diff_new_pack.6rHcGy/_old 2022-11-01 13:42:16.995805126 +0100
+++ /var/tmp/diff_new_pack.6rHcGy/_new 2022-11-01 13:42:16.999805147 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-sphinxext-opengraph
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -27,7 +27,7 @@
%endif
%define skip_python2 1
Name: python-sphinxext-opengraph
-Version: 0.4.2
+Version: 0.6.3
Release: 0
Summary: Sphinx Extension to enable OGP support
License: MIT
++++++ sphinxext-opengraph-0.4.2.tar.gz -> sphinxext-opengraph-0.6.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/README.md new/sphinxext-opengraph-0.6.3/README.md
--- old/sphinxext-opengraph-0.4.2/README.md 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/README.md 2022-03-29 19:45:08.000000000 +0200
@@ -28,7 +28,7 @@
* `ogp_site_name`
* This is not required. Name of the site. This is displayed above the title.
* `ogp_image`
- * This is not required. Link to image to show.
+ * This is not required. Link to image to show. Note that all relative paths are converted to be relative to the root of the html output as defined by `ogp_site_name`.
* `ogp_image_alt`
* This is not required. Alt text for image. Defaults to using `ogp_site_name` or the document's title as alt text, if available. Set to `False` if you want to turn off alt text completely.
* `ogp_use_first_image`
@@ -37,7 +37,7 @@
* This sets the ogp type attribute, for more information on the types available please take a look at https://ogp.me/#types. By default it is set to `website`, which should be fine for most use cases.
* `ogp_custom_meta_tags`
* This is not required. List of custom html snippets to insert.
-
+
## Example Config
### Simple Config
@@ -60,3 +60,48 @@
]
```
+
+## Per Page Overrides
+[Field lists](https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-li… are used to allow you to override certain settings on each page and set unsupported arbitrary OpenGraph tags.
+
+Make sure you place the fields at the very start of the document such that Sphinx will pick them up and also won't build them into the html.
+
+### Overrides
+These are some overrides that can be used, you can actually override any tag and field lists will always take priority.
+
+* `:og_description_length:`
+ * Configure the amount of characters to grab for the description of the page. If the value isn't a number it will fall back to `ogp_description_length`. Note the slightly different syntax because this isn't directly an OpenGraph tag.
+* `:og:description:`
+ * Lets you override the description of the page.
+* `:og:title:`
+ * Lets you override the title of the page.
+* `:og:type:`
+ * Override the type of the page, for the list of available types take a look at https://ogp.me/#types.
+* `:ogp:image:`
+ * Set the image for the page.[^1]
+* `:ogp:image:alt:`
+ * Sets the alt text. Will be ignored if there is no image set.
+
+### Example
+Remember that the fields **must** be placed at the very start of the file. You can verify Sphinx has picked up the fields if they aren't shown in the final html file.
+
+```rst
+:og:description: New description
+:og:image: http://example.org/image.png
+:og:image:alt: Example Image
+
+Page contents
+=============
+```
+
+### Arbitrary Tags[^1]
+Additionally, you can use field lists to add any arbitrary OpenGraph tag not supported by the extension. The syntax for arbitrary tags is the same with `:og:tag: content`. For Example:
+
+```rst
+:og:video: http://example.org/video.mp4
+
+Page contents
+=============
+```
+
+[^1]: Note: Relative file paths for images, videos and audio are currently **not** supported when using field lists. Please use an absolute path instead.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/docs/requirements.txt new/sphinxext-opengraph-0.6.3/docs/requirements.txt
--- old/sphinxext-opengraph-0.4.2/docs/requirements.txt 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/docs/requirements.txt 2022-03-29 19:45:08.000000000 +0200
@@ -1,4 +1,4 @@
-myst-parser==0.13.0
-furo==2020.12.30b24
-sphinx==3.4.0
+myst-parser==0.15.2
+furo==2021.11.12.1
+sphinx==4.2.0
./
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/setup.py new/sphinxext-opengraph-0.6.3/setup.py
--- old/sphinxext-opengraph-0.4.2/setup.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/setup.py 2022-03-29 19:45:08.000000000 +0200
@@ -28,6 +28,7 @@
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/wpilibsuite/sphinxext-opengraph",
+ license="LICENSE.md",
install_requires=["sphinx>=2.0"],
packages=["sphinxext/opengraph"],
classifiers=[
@@ -36,12 +37,13 @@
"Environment :: Web Environment",
"Framework :: Sphinx :: Extension",
"Intended Audience :: Developers",
- "License :: OSI Approved :: MIT License",
+ "License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
"Programming Language :: Python",
"Topic :: Documentation :: Sphinx",
"Topic :: Documentation",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/sphinxext/opengraph/__init__.py new/sphinxext-opengraph-0.6.3/sphinxext/opengraph/__init__.py
--- old/sphinxext-opengraph-0.4.2/sphinxext/opengraph/__init__.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/sphinxext/opengraph/__init__.py 2022-03-29 19:45:08.000000000 +0200
@@ -1,10 +1,9 @@
from typing import Any, Dict
from urllib.parse import urljoin, urlparse, urlunparse
-from pathlib import Path, PosixPath
+from pathlib import Path
import docutils.nodes as nodes
from sphinx.application import Sphinx
-from sphinx.util import logger
from .descriptionparser import get_description
from .titleparser import get_title
@@ -30,6 +29,8 @@
def make_tag(property: str, content: str) -> str:
+ # Parse quotation, so they won't break html tags if smart quotes are disabled
+ content = content.replace('"', """)
return f'<meta property="{property}" content="{content}" />\n '
@@ -39,10 +40,17 @@
doctree: nodes.document,
config: Dict[str, Any],
) -> str:
+ # Get field lists for per-page overrides
+ fields = context["meta"]
+ if fields is None:
+ fields = {}
+ tags = {}
# Set length of description
try:
- desc_len = int(config["ogp_description_length"])
+ desc_len = int(
+ fields.get("ogp_description_length", config["ogp_description_length"])
+ )
except ValueError:
desc_len = DEFAULT_DESCRIPTION_LENGTH
@@ -53,13 +61,12 @@
# Parse/walk doctree for metadata (tag/description)
description = get_description(doctree, desc_len, [title, title_excluding_html])
- tags = "\n "
-
# title tag
- tags += make_tag("og:title", title)
+ tags["og:title"] = title
# type tag
- tags += make_tag("og:type", config["ogp_type"])
+ tags["og:type"] = config["ogp_type"]
+
if os.getenv("READTHEDOCS") and config["ogp_site_url"] is None:
# readthedocs uses html_baseurl for sphinx > 1.8
parse_result = urlparse(config["html_baseurl"])
@@ -81,26 +88,38 @@
# url tag
# Get the URL of the specific page
- page_url = urljoin(
- config["ogp_site_url"], context["pagename"] + context["file_suffix"]
- )
- tags += make_tag("og:url", page_url)
+ if context["builder"] == "dirhtml":
+ page_url = urljoin(config["ogp_site_url"], context["pagename"] + "/")
+ else:
+ page_url = urljoin(
+ config["ogp_site_url"], context["pagename"] + context["file_suffix"]
+ )
+ tags["og:url"] = page_url
# site name tag
site_name = config["ogp_site_name"]
if site_name:
- tags += make_tag("og:site_name", site_name)
+ tags["og:site_name"] = site_name
# description tag
if description:
- tags += make_tag("og:description", description)
+ tags["og:description"] = description
# image tag
# Get basic values from config
- image_url = config["ogp_image"]
- ogp_use_first_image = config["ogp_use_first_image"]
- ogp_image_alt = config["ogp_image_alt"]
+ if "og:image" in fields:
+ image_url = fields["og:image"]
+ ogp_use_first_image = False
+ ogp_image_alt = fields.get("og:image:alt")
+ fields.pop("og:image", None)
+ else:
+ image_url = config["ogp_image"]
+ ogp_use_first_image = config["ogp_use_first_image"]
+ ogp_image_alt = fields.get("og:image:alt", config["ogp_image_alt"])
+
+ fields.pop("og:image:alt", None)
+ first_image = None
if ogp_use_first_image:
first_image = doctree.next_node(nodes.image)
if (
@@ -109,22 +128,39 @@
):
image_url = first_image["uri"]
ogp_image_alt = first_image.get("alt", None)
+ else:
+ first_image = None
if image_url:
- tags += make_tag("og:image", image_url)
+ # temporarily disable relative image paths with field lists
+ if "og:image" not in fields:
+ image_url_parsed = urlparse(image_url)
+ if not image_url_parsed.scheme:
+ # Relative image path detected, relative to the source. Make absolute.
+ if first_image:
+ root = page_url
+ else: # ogp_image is set
+ # ogp_image is defined as being relative to the site root.
+ # This workaround is to keep that functionality from breaking.
+ root = config["ogp_site_url"]
+
+ image_url = urljoin(root, image_url_parsed.path)
+ tags["og:image"] = image_url
# Add image alt text (either provided by config or from site_name)
if isinstance(ogp_image_alt, str):
- tags += make_tag("og:image:alt", ogp_image_alt)
+ tags["og:image:alt"] = ogp_image_alt
elif ogp_image_alt is None and site_name:
- tags += make_tag("og:image:alt", site_name)
+ tags["og:image:alt"] = site_name
elif ogp_image_alt is None and title:
- tags += make_tag("og:image:alt", title)
+ tags["og:image:alt"] = title
- # custom tags
- tags += "\n".join(config["ogp_custom_meta_tags"])
+ # arbitrary tags and overrides
+ tags.update({k: v for k, v in fields.items() if k.startswith("og:")})
- return tags
+ return "\n" + "\n".join(
+ [make_tag(p, c) for p, c in tags.items()] + config["ogp_custom_meta_tags"]
+ )
def html_page_context(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/sphinxext/opengraph/descriptionparser.py new/sphinxext-opengraph-0.6.3/sphinxext/opengraph/descriptionparser.py
--- old/sphinxext-opengraph-0.4.2/sphinxext/opengraph/descriptionparser.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/sphinxext/opengraph/descriptionparser.py 2022-03-29 19:45:08.000000000 +0200
@@ -18,7 +18,7 @@
# Hack to prevent requirement for the doctree to be passed in.
# It's only used by doctree.walk(...) to print debug messages.
- if document == None:
+ if document is None:
class document_cls:
class reporter:
@@ -67,7 +67,7 @@
if node.astext() in self.known_titles:
raise nodes.SkipNode
- if isinstance(node, nodes.raw):
+ if isinstance(node, nodes.raw) or isinstance(node.parent, nodes.literal_block):
raise nodes.SkipNode
# Only include leaf nodes in the description
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/conftest.py new/sphinxext-opengraph-0.6.3/tests/conftest.py
--- old/sphinxext-opengraph-0.4.2/tests/conftest.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/conftest.py 2022-03-29 19:45:08.000000000 +0200
@@ -19,8 +19,11 @@
yield app
-def _meta_tags(content):
- c = (content.outdir / "index.html").read_text()
+def _meta_tags(content, subdir=None):
+ if subdir is None:
+ c = (content.outdir / "index.html").read_text()
+ else:
+ c = (content.outdir / subdir / "index.html").read_text()
return BeautifulSoup(c, "html.parser").find_all("meta")
@@ -42,5 +45,14 @@
]
+(a)pytest.fixture()
+def og_meta_tags_sub(content):
+ return [
+ tag
+ for tag in _meta_tags(content, "sub")
+ if tag.get("property", "").startswith("og:")
+ ]
+
+
def pytest_configure(config):
config.addinivalue_line("markers", "sphinx")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-arbitrary-tags/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-arbitrary-tags/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-arbitrary-tags/conf.py 1970-01-01 01:00:00.000000000 +0100
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-arbitrary-tags/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -0,0 +1,8 @@
+extensions = ["sphinxext.opengraph"]
+
+master_doc = "index"
+exclude_patterns = ["_build"]
+
+html_theme = "basic"
+
+ogp_site_url = "http://example.org/en/latest/"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-arbitrary-tags/index.rst new/sphinxext-opengraph-0.6.3/tests/roots/test-arbitrary-tags/index.rst
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-arbitrary-tags/index.rst 1970-01-01 01:00:00.000000000 +0100
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-arbitrary-tags/index.rst 2022-03-29 19:45:08.000000000 +0200
@@ -0,0 +1,4 @@
+:og:video: http://example.org/en/latest/video.mp4
+:og:video:type: video/mp4
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse at lorem ornare, fringilla massa nec, venenatis mi. Donec erat sapien, tincidunt nec rhoncus nec, scelerisque id diam. Orci varius natoque penatibus et magnis dis parturient mauris.
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-custom-tags/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-custom-tags/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-custom-tags/conf.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-custom-tags/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -5,7 +5,7 @@
html_theme = "basic"
-ogp_site_url = "http://example.org/"
+ogp_site_url = "http://example.org/en/latest/"
ogp_custom_meta_tags = [
'<meta property="og:ignore_canonical" content="true" />',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-description-length/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-description-length/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-description-length/conf.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-description-length/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -5,5 +5,5 @@
html_theme = "basic"
-ogp_site_url = "http://example.org/"
+ogp_site_url = "http://example.org/en/latest/"
ogp_description_length = 50
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-double-spacing/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-double-spacing/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-double-spacing/conf.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-double-spacing/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -5,4 +5,4 @@
html_theme = "basic"
-ogp_site_url = "http://example.org/"
+ogp_site_url = "http://example.org/en/latest/"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-first-image/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-first-image/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-first-image/conf.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-first-image/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -6,7 +6,7 @@
html_theme = "basic"
ogp_site_name = "Example's Docs!"
-ogp_site_url = "http://example.org/"
-ogp_image = "http://example.org/image33.png"
+ogp_site_url = "http://example.org/en/latest/"
+ogp_image = "http://example.org/en/latest/image33.png"
ogp_image_alt = "TEST"
ogp_use_first_image = True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-first-image/index.rst new/sphinxext-opengraph-0.6.3/tests/roots/test-first-image/index.rst
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-first-image/index.rst 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-first-image/index.rst 2022-03-29 19:45:08.000000000 +0200
@@ -1,2 +1,2 @@
-.. image:: http://example.org/image2.png
+.. image:: http://example.org/en/latest/image2.png
:alt: Test image alt text
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-first-image-no-image/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-first-image-no-image/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-first-image-no-image/conf.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-first-image-no-image/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -6,7 +6,7 @@
html_theme = "basic"
ogp_site_name = "Example's Docs!"
-ogp_site_url = "http://example.org/"
-ogp_image = "http://example.org/image33.png"
+ogp_site_url = "http://example.org/en/latest/"
+ogp_image = "http://example.org/en/latest/image33.png"
ogp_image_alt = "TEST"
ogp_use_first_image = True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-image/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-image/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-image/conf.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-image/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -6,5 +6,5 @@
html_theme = "basic"
ogp_site_name = "Example's Docs!"
-ogp_site_url = "http://example.org/"
-ogp_image = "http://example.org/image.png"
+ogp_site_url = "http://example.org/en/latest/"
+ogp_image = "http://example.org/en/latest/image.png"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-image-rel-paths/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-image-rel-paths/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-image-rel-paths/conf.py 1970-01-01 01:00:00.000000000 +0100
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-image-rel-paths/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -0,0 +1,11 @@
+extensions = ["sphinxext.opengraph"]
+
+master_doc = "index"
+exclude_patterns = ["_build"]
+
+html_theme = "basic"
+
+ogp_site_name = "Example's Docs!"
+ogp_site_url = "http://example.org/en/latest/"
+ogp_image = "_static/image33.png"
+ogp_use_first_image = True
Binary files old/sphinxext-opengraph-0.4.2/tests/roots/test-image-rel-paths/img/sample.jpg and new/sphinxext-opengraph-0.6.3/tests/roots/test-image-rel-paths/img/sample.jpg differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-image-rel-paths/index.rst new/sphinxext-opengraph-0.6.3/tests/roots/test-image-rel-paths/index.rst
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-image-rel-paths/index.rst 1970-01-01 01:00:00.000000000 +0100
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-image-rel-paths/index.rst 2022-03-29 19:45:08.000000000 +0200
@@ -0,0 +1,2 @@
+.. image:: img/sample.jpg
+ :alt: Test image alt text
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-image-rel-paths/sub/index.rst new/sphinxext-opengraph-0.6.3/tests/roots/test-image-rel-paths/sub/index.rst
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-image-rel-paths/sub/index.rst 1970-01-01 01:00:00.000000000 +0100
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-image-rel-paths/sub/index.rst 2022-03-29 19:45:08.000000000 +0200
@@ -0,0 +1,6 @@
+========
+Sub Page
+========
+
+.. image:: ../img/sample.jpg
+ :alt: Test image alt text
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-list/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-list/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-list/conf.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-list/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -5,4 +5,4 @@
html_theme = "basic"
-ogp_site_url = "http://example.org/"
+ogp_site_url = "http://example.org/en/latest/"
Binary files old/sphinxext-opengraph-0.4.2/tests/roots/test-local-image/_static/sample.jpg and new/sphinxext-opengraph-0.6.3/tests/roots/test-local-image/_static/sample.jpg differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-local-image/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-local-image/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-local-image/conf.py 1970-01-01 01:00:00.000000000 +0100
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-local-image/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -0,0 +1,10 @@
+extensions = ["sphinxext.opengraph"]
+
+master_doc = "index"
+exclude_patterns = ["_build"]
+
+html_theme = "basic"
+
+ogp_site_name = "Example's Docs!"
+ogp_site_url = "http://example.org/en/latest/"
+ogp_image = "_static/sample.jpg"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-nested-lists/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-nested-lists/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-nested-lists/conf.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-nested-lists/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -5,4 +5,4 @@
html_theme = "basic"
-ogp_site_url = "http://example.org/"
+ogp_site_url = "http://example.org/en/latest/"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-overrides-complex/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-overrides-complex/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-overrides-complex/conf.py 1970-01-01 01:00:00.000000000 +0100
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-overrides-complex/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -0,0 +1,10 @@
+extensions = ["sphinxext.opengraph"]
+
+master_doc = "index"
+exclude_patterns = ["_build"]
+
+html_theme = "basic"
+
+ogp_site_name = "Example's Docs!"
+ogp_site_url = "http://example.org/en/latest/"
+ogp_image_alt = "Example Alt Text"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-overrides-complex/index.rst new/sphinxext-opengraph-0.6.3/tests/roots/test-overrides-complex/index.rst
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-overrides-complex/index.rst 1970-01-01 01:00:00.000000000 +0100
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-overrides-complex/index.rst 2022-03-29 19:45:08.000000000 +0200
@@ -0,0 +1,7 @@
+:ogp_description_length: 10
+:og:image: img/sample.jpg
+:og:image:alt: Overridden Alt Text
+
+Lorem Ipsum
+===========
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse at lorem ornare, fringilla massa nec, venenatis mi. Donec erat sapien, tincidunt nec rhoncus nec, scelerisque id diam. Orci varius natoque penatibus et magnis dis parturient mauris.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-overrides-simple/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-overrides-simple/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-overrides-simple/conf.py 1970-01-01 01:00:00.000000000 +0100
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-overrides-simple/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -0,0 +1,11 @@
+extensions = ["sphinxext.opengraph"]
+
+master_doc = "index"
+exclude_patterns = ["_build"]
+
+html_theme = "basic"
+
+ogp_site_name = "Example's Docs!"
+ogp_site_url = "http://example.org/en/latest/"
+ogp_image = "http://example.org/en/latest/image.png"
+ogp_type = "book"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-overrides-simple/index.rst new/sphinxext-opengraph-0.6.3/tests/roots/test-overrides-simple/index.rst
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-overrides-simple/index.rst 1970-01-01 01:00:00.000000000 +0100
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-overrides-simple/index.rst 2022-03-29 19:45:08.000000000 +0200
@@ -0,0 +1,8 @@
+:og:description: Overridden description
+:og:title: Overridden Title
+:og:type: article
+:og:image: http://example.org/en/latest/overridden-image.png
+
+Lorem Ipsum
+===========
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse at lorem ornare, fringilla massa nec, venenatis mi. Donec erat sapien, tincidunt nec rhoncus nec, scelerisque id diam. Orci varius natoque penatibus et magnis dis parturient mauris.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-quotation-marks/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-quotation-marks/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-quotation-marks/conf.py 1970-01-01 01:00:00.000000000 +0100
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-quotation-marks/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -0,0 +1,10 @@
+extensions = ["sphinxext.opengraph"]
+
+master_doc = "index"
+exclude_patterns = ["_build"]
+
+html_theme = "basic"
+
+smartquotes = False
+
+ogp_site_url = "http://example.org/en/latest/"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-quotation-marks/index.rst new/sphinxext-opengraph-0.6.3/tests/roots/test-quotation-marks/index.rst
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-quotation-marks/index.rst 1970-01-01 01:00:00.000000000 +0100
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-quotation-marks/index.rst 2022-03-29 19:45:08.000000000 +0200
@@ -0,0 +1 @@
+"This text should appear in escaped quotation marks" This text should still appear as well "while this is once again in quotations"
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-simple/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-simple/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-simple/conf.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-simple/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -5,4 +5,4 @@
html_theme = "basic"
-ogp_site_url = "http://example.org/"
+ogp_site_url = "http://example.org/en/latest/"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-sitename/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-sitename/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-sitename/conf.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-sitename/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -5,5 +5,5 @@
html_theme = "basic"
-ogp_site_url = "http://example.org/"
+ogp_site_url = "http://example.org/en/latest/"
ogp_site_name = "Example's Docs!"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-skip-admonitions/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-skip-admonitions/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-skip-admonitions/conf.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-skip-admonitions/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -5,4 +5,4 @@
html_theme = "basic"
-ogp_site_url = "http://example.org/"
+ogp_site_url = "http://example.org/en/latest/"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-skip-code-block/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-skip-code-block/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-skip-code-block/conf.py 1970-01-01 01:00:00.000000000 +0100
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-skip-code-block/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -0,0 +1,9 @@
+extensions = ["sphinxext.opengraph"]
+
+master_doc = "index"
+exclude_patterns = ["_build"]
+
+html_theme = "basic"
+
+ogp_site_url = "http://example.org/en/latest/"
+ogp_description_length = 100
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-skip-code-block/index.rst new/sphinxext-opengraph-0.6.3/tests/roots/test-skip-code-block/index.rst
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-skip-code-block/index.rst 1970-01-01 01:00:00.000000000 +0100
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-skip-code-block/index.rst 2022-03-29 19:45:08.000000000 +0200
@@ -0,0 +1,7 @@
+This text should be included.
+
+.. code-block:: html
+
+ <p> This text should be skipped. </p>
+
+This text should also be included.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-skip-comments/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-skip-comments/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-skip-comments/conf.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-skip-comments/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -5,4 +5,4 @@
html_theme = "basic"
-ogp_site_url = "http://example.org/"
+ogp_site_url = "http://example.org/en/latest/"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-skip-raw/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-skip-raw/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-skip-raw/conf.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-skip-raw/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -5,5 +5,5 @@
html_theme = "basic"
-ogp_site_url = "http://example.org/"
+ogp_site_url = "http://example.org/en/latest/"
ogp_description_length = 100
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-skip-title/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-skip-title/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-skip-title/conf.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-skip-title/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -5,4 +5,4 @@
html_theme = "basic"
-ogp_site_url = "http://example.org/"
+ogp_site_url = "http://example.org/en/latest/"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/roots/test-type/conf.py new/sphinxext-opengraph-0.6.3/tests/roots/test-type/conf.py
--- old/sphinxext-opengraph-0.4.2/tests/roots/test-type/conf.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/roots/test-type/conf.py 2022-03-29 19:45:08.000000000 +0200
@@ -5,5 +5,5 @@
html_theme = "basic"
-ogp_site_url = "http://example.org/"
+ogp_site_url = "http://example.org/en/latest/"
ogp_type = "article"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinxext-opengraph-0.4.2/tests/test_options.py new/sphinxext-opengraph-0.6.3/tests/test_options.py
--- old/sphinxext-opengraph-0.4.2/tests/test_options.py 2021-05-26 13:28:12.000000000 +0200
+++ new/sphinxext-opengraph-0.6.3/tests/test_options.py 2022-03-29 19:45:08.000000000 +0200
@@ -29,12 +29,31 @@
@pytest.mark.sphinx("html", testroot="simple")
def test_site_url(og_meta_tags):
# Uses the same directory as simple, because it already contains url for a minimal config
- assert get_tag_content(og_meta_tags, "url") == "http://example.org/index.html"
+ assert (
+ get_tag_content(og_meta_tags, "url")
+ == "http://example.org/en/latest/index.html"
+ )
+
+
+(a)pytest.mark.sphinx("dirhtml", testroot="simple")
+def test_dirhtml_url(og_meta_tags):
+ assert get_tag_content(og_meta_tags, "url") == "http://example.org/en/latest/index/"
@pytest.mark.sphinx("html", testroot="image")
def test_image(og_meta_tags):
- assert get_tag_content(og_meta_tags, "image") == "http://example.org/image.png"
+ assert (
+ get_tag_content(og_meta_tags, "image")
+ == "http://example.org/en/latest/image.png"
+ )
+
+
+(a)pytest.mark.sphinx("html", testroot="local-image")
+def test_local_image(og_meta_tags):
+ assert (
+ get_tag_content(og_meta_tags, "image")
+ == "http://example.org/en/latest/_static/sample.jpg"
+ )
@pytest.mark.sphinx("html", testroot="image")
@@ -59,16 +78,34 @@
@pytest.mark.sphinx("html", testroot="first-image")
def test_first_image(og_meta_tags):
- assert get_tag_content(og_meta_tags, "image") == "http://example.org/image2.png"
+ assert (
+ get_tag_content(og_meta_tags, "image")
+ == "http://example.org/en/latest/image2.png"
+ )
assert get_tag_content(og_meta_tags, "image:alt") == "Test image alt text"
@pytest.mark.sphinx("html", testroot="first-image-no-image")
def test_first_image_no_image(og_meta_tags):
- assert get_tag_content(og_meta_tags, "image") == "http://example.org/image33.png"
+ assert (
+ get_tag_content(og_meta_tags, "image")
+ == "http://example.org/en/latest/image33.png"
+ )
assert get_tag_content(og_meta_tags, "image:alt") == "TEST"
+(a)pytest.mark.sphinx("html", testroot="image-rel-paths")
+def test_image_rel_paths(og_meta_tags, og_meta_tags_sub):
+ assert (
+ get_tag_content(og_meta_tags, "image")
+ == "http://example.org/en/latest/_images/sample.jpg"
+ )
+ assert (
+ get_tag_content(og_meta_tags_sub, "image")
+ == "http://example.org/en/latest/_images/sample.jpg"
+ )
+
+
@pytest.mark.sphinx("html", testroot="skip-admonitions")
def test_skip_admonitions(og_meta_tags):
assert get_tag_content(og_meta_tags, "description") == "This is text."
@@ -127,27 +164,80 @@
)
+(a)pytest.mark.sphinx("html", testroot="skip-code-block")
+def test_skip_code_block(og_meta_tags):
+ description = get_tag_content(og_meta_tags, "description")
+ assert "<p>" not in description
+ assert (
+ description
+ == "This text should be included. This text should also be included."
+ )
+
+
+(a)pytest.mark.sphinx("html", testroot="quotation-marks")
+def test_quotation_marks(og_meta_tags):
+ # If smart quotes are disabled and the quotes aren't properly escaped, bs4 will fail to parse the tag and the content will be a empty string
+ description = get_tag_content(og_meta_tags, "description")
+
+ assert (
+ description
+ == '"This text should appear in escaped quotation marks" This text should still appear as well "while this is once again in quotations"'
+ )
+
+
+(a)pytest.mark.sphinx("html", testroot="overrides-simple")
+def test_overrides_simple(og_meta_tags):
+ assert get_tag_content(og_meta_tags, "description") == "Overridden description"
+ assert get_tag_content(og_meta_tags, "title") == "Overridden Title"
+ assert get_tag_content(og_meta_tags, "type") == "article"
+ assert (
+ get_tag_content(og_meta_tags, "image")
+ == "http://example.org/en/latest/overridden-image.png"
+ )
+ # Make sure alt text still works even when overriding the image
+ assert get_tag_content(og_meta_tags, "image:alt") == "Example's Docs!"
+
+
+(a)pytest.mark.sphinx("html", testroot="overrides-complex")
+def test_overrides_complex(og_meta_tags):
+ assert len(get_tag_content(og_meta_tags, "description")) == 10
+ assert (
+ get_tag_content(og_meta_tags, "image")
+ == "http://example.org/en/latest/img/sample.jpg"
+ )
+ assert get_tag_content(og_meta_tags, "image:alt") == "Overridden Alt Text"
+
+
+(a)pytest.mark.sphinx("html", testroot="arbitrary-tags")
+def test_arbitrary_tags(og_meta_tags):
+ assert (
+ get_tag_content(og_meta_tags, "video")
+ == "http://example.org/en/latest/video.mp4"
+ )
+ assert get_tag_content(og_meta_tags, "video:type") == "video/mp4"
+
+
# use same as simple, as configuration is identical to overriden
@pytest.mark.sphinx("html", testroot="simple")
def test_rtd_override(app: Sphinx, monkeypatch):
monkeypatch.setenv("READTHEDOCS", "True")
- app.config.html_baseurl = "https://failure.com"
+ app.config.html_baseurl = "https://failure.com/en/latest/"
app.build()
tags = conftest._og_meta_tags(app)
- assert get_tag_content(tags, "url") == "http://example.org/index.html"
+ assert get_tag_content(tags, "url") == "http://example.org/en/latest/index.html"
@pytest.mark.sphinx("html", testroot="rtd-default")
def test_rtd_valid(app: Sphinx, monkeypatch):
monkeypatch.setenv("READTHEDOCS", "True")
- app.config.html_baseurl = "https://failure.com"
+ app.config.html_baseurl = "https://failure.com/en/latest/"
app.build()
tags = conftest._og_meta_tags(app)
- assert get_tag_content(tags, "url") == "https://failure.com/index.html"
+ assert get_tag_content(tags, "url") == "https://failure.com/en/latest/index.html"
# use rtd-default, as we are not changing configuration, but RTD variables
1
0