Hello community,

here is the log from the commit of package python-pretend for openSUSE:Factory 
checked in at 2019-02-25 17:44:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pretend (Old)
 and      /work/SRC/openSUSE:Factory/.python-pretend.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pretend"

Mon Feb 25 17:44:57 2019 rev:5 rq:674896 version:1.0.9

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pretend/python-pretend.changes    
2018-12-27 00:27:34.691752124 +0100
+++ /work/SRC/openSUSE:Factory/.python-pretend.new.28833/python-pretend.changes 
2019-02-25 17:44:59.902916354 +0100
@@ -1,0 +2,8 @@
+Thu Feb 14 08:25:57 UTC 2019 - John Vandenberg <[email protected]>
+
+- Activate test suite
+- Update to v1.0.9
+  * Make 'stub' object callable
+  * Build and doc enhancements
+
+-------------------------------------------------------------------
@@ -14,2 +22 @@
-- Initial version
-
+- Initial version for v1.0.8

Old:
----
  pretend-1.0.8.tar.gz

New:
----
  pretend-1.0.9.tar.gz
  test_pretend.py

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pretend.spec ++++++
--- /var/tmp/diff_new_pack.NVNWU8/_old  2019-02-25 17:45:01.758915592 +0100
+++ /var/tmp/diff_new_pack.NVNWU8/_new  2019-02-25 17:45:01.762915591 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-pretend
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,13 +18,15 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-pretend
-Version:        1.0.8
+Version:        1.0.9
 Release:        0
 Summary:        A library for stubbing in Python
 License:        BSD-3-Clause
 Group:          Development/Languages/Python
 URL:            https://github.com/alex/pretend
 Source:         
https://files.pythonhosted.org/packages/source/p/pretend/pretend-%{version}.tar.gz
+Source1:        
https://raw.githubusercontent.com/alex/pretend/master/test_pretend.py
+BuildRequires:  %{python_module pytest}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  python-rpm-macros
 BuildArch:      noarch
@@ -35,6 +37,7 @@
 
 %prep
 %setup -q -n pretend-%{version}
+cp %{SOURCE1} .
 
 %build
 %python_build
@@ -42,6 +45,9 @@
 %install
 %python_install
 
+%check
+%python_exec -m pytest
+
 %files %{python_files}
 %license LICENSE.rst
 %doc README.rst

++++++ pretend-1.0.8.tar.gz -> pretend-1.0.9.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pretend-1.0.8/PKG-INFO new/pretend-1.0.9/PKG-INFO
--- old/pretend-1.0.8/PKG-INFO  2014-03-08 23:31:14.000000000 +0100
+++ new/pretend-1.0.9/PKG-INFO  2018-04-14 16:30:34.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pretend
-Version: 1.0.8
+Version: 1.0.9
 Summary: A library for stubbing in Python
 Home-page: https://github.com/alex/pretend
 Author: Alex Gaynor
@@ -51,7 +51,7 @@
         or methods, nor does it have any methods for making assertions about 
what you
         accessed.
         
-        If you want to add a method to the stub, simple provide a function to 
it:
+        If you want to add a method to the stub, simply provide a function to 
it:
         
         .. code:: pycon
         
@@ -132,3 +132,6 @@
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3.2
 Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pretend-1.0.8/README.rst new/pretend-1.0.9/README.rst
--- old/pretend-1.0.8/README.rst        2013-07-29 19:38:15.000000000 +0200
+++ new/pretend-1.0.9/README.rst        2017-09-03 21:55:02.000000000 +0200
@@ -43,7 +43,7 @@
 or methods, nor does it have any methods for making assertions about what you
 accessed.
 
-If you want to add a method to the stub, simple provide a function to it:
+If you want to add a method to the stub, simply provide a function to it:
 
 .. code:: pycon
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pretend-1.0.8/pretend.egg-info/PKG-INFO 
new/pretend-1.0.9/pretend.egg-info/PKG-INFO
--- old/pretend-1.0.8/pretend.egg-info/PKG-INFO 2014-03-08 23:31:14.000000000 
+0100
+++ new/pretend-1.0.9/pretend.egg-info/PKG-INFO 2018-04-14 16:30:34.000000000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pretend
-Version: 1.0.8
+Version: 1.0.9
 Summary: A library for stubbing in Python
 Home-page: https://github.com/alex/pretend
 Author: Alex Gaynor
@@ -51,7 +51,7 @@
         or methods, nor does it have any methods for making assertions about 
what you
         accessed.
         
-        If you want to add a method to the stub, simple provide a function to 
it:
+        If you want to add a method to the stub, simply provide a function to 
it:
         
         .. code:: pycon
         
@@ -132,3 +132,6 @@
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3.2
 Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pretend-1.0.8/pretend.py new/pretend-1.0.9/pretend.py
--- old/pretend-1.0.8/pretend.py        2014-03-08 23:26:23.000000000 +0100
+++ new/pretend-1.0.9/pretend.py        2017-09-03 21:55:02.000000000 +0200
@@ -37,6 +37,7 @@
     "__truediv__",
     "__xor__",
 
+    "__call__",
     "__repr__",
 ])
 if PY3K:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pretend-1.0.8/setup.cfg new/pretend-1.0.9/setup.cfg
--- old/pretend-1.0.8/setup.cfg 2014-03-08 23:31:14.000000000 +0100
+++ new/pretend-1.0.9/setup.cfg 2018-04-14 16:30:34.000000000 +0200
@@ -4,5 +4,4 @@
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pretend-1.0.8/setup.py new/pretend-1.0.9/setup.py
--- old/pretend-1.0.8/setup.py  2014-03-08 23:30:09.000000000 +0100
+++ new/pretend-1.0.9/setup.py  2018-04-14 16:29:04.000000000 +0200
@@ -5,7 +5,7 @@
     readme = f.read()
 
 setup(
-    version="1.0.8",
+    version="1.0.9",
     name="pretend",
     description="A library for stubbing in Python",
     long_description=readme,
@@ -24,5 +24,8 @@
         "Programming Language :: Python :: 2.7",
         "Programming Language :: Python :: 3.2",
         "Programming Language :: Python :: 3.3",
+        "Programming Language :: Python :: 3.4",
+        "Programming Language :: Python :: 3.5",
+        "Programming Language :: Python :: 3.6",
     ]
 )

++++++ test_pretend.py ++++++
import operator

import pytest

from pretend import stub, raiser, call, call_recorder, PY3K


class TestStub(object):
    def test_attribute(self):
        x = stub(attr=3)
        assert hasattr(x, "attr")
        assert x.attr == 3

    def test_function(self):
        x = stub(meth=lambda x, y: x + y)
        assert x.meth(3, 4) == 7

    def test_iter(self):
        x = stub(__iter__=lambda: iter([1, 2, 3]))
        iterator = iter(x)
        assert next(iterator) == 1

    @pytest.mark.skipif("not PY3K")
    def test_next(self):
        x = stub(__next__=lambda: 12)
        assert next(x) == 12

    def test_contains(self):
        x = stub(__contains__=lambda other: True)
        assert "hello world" in x

    @pytest.mark.skipif("PY3K")
    def test_nonzero(self):
        x = stub(__nonzero__=lambda: False)
        assert not bool(x)

    @pytest.mark.skipif("not PY3K")
    def test_bool(self):
        x = stub(__bool__=lambda: False)
        assert not bool(x)

    def test_len(self):
        x = stub(__len__=lambda: 12)
        assert len(x) == 12

    @pytest.mark.parametrize(("func", "op"), [
        (operator.lt, "__lt__"),
        (operator.le, "__le__"),
        (operator.eq, "__eq__"),
        (operator.ne, "__ne__"),
        (operator.gt, "__gt__"),
        (operator.ge, "__ge__"),

        (operator.add, "__add__"),
        (operator.and_, "__and__"),
        (divmod, "__divmod__"),
        (operator.floordiv, "__floordiv__"),
        (operator.lshift, "__lshift__"),
        (operator.mod, "__mod__"),
        (operator.mul, "__mul__"),
        (operator.or_, "__or__"),
        (operator.pow, "__pow__"),
        (operator.rshift, "__rshift__"),
        (operator.sub, "__sub__"),
        (operator.truediv, "__truediv__"),
        (operator.xor, "__xor__"),
    ])
    def test_special_binops(self, func, op):
        x = stub(**{
            op: lambda y: func(2, y)
        })
        assert func(x, 4) == func(2, 4)
        assert func(x, 2) == func(2, 2)

    @pytest.mark.skipif("PY3K")
    def test_div(self):
        x = stub(
            __div__=lambda y: 4
        )
        assert x / 3 == 4

    def test_missing_op_error(self):
        x = stub()
        with pytest.raises(TypeError):
            x + 2

    def test_subscript(self):
        x = stub(
            __getitem__=lambda idx: idx
        )
        assert x[5] == 5
        assert x[1, 2] == (1, 2)

    def test_setitem(self):
        d = {}
        x = stub(
            __setitem__=d.__setitem__
        )
        x[5] = 'a'
        x['b'] = 6
        assert d == {5: 'a', 'b': 6}

    def test_delitem(self):
        d = {5: 'a', 'b': 6}
        x = stub(
            __delitem__=d.__delitem__
        )
        del x['b']
        assert d == {5: 'a'}

    def test_context_manager(self):
        should_reraise = True
        x = stub(
            __enter__=lambda: 3,
            __exit__=lambda exc_type, exc_value, tb: should_reraise
        )
        with x as value:
            assert value == 3
            raise ValueError
        should_reraise = False
        with pytest.raises(ValueError):
            with x as value:
                assert value == 3
                raise ValueError

    def test_default_repr(self):
        x = stub(a=10)

        assert repr(x) == "<stub(a=10)>"

    def test_custom_repr(self):
        x = stub(id=300, __repr__=lambda: '<Something>')

        assert x.id == 300
        assert repr(x) == '<Something>'

    def test_callable(self):
        x = stub(__call__=lambda: 4)

        assert x() == 4


class TestRaiser(object):
    def test_call_raiser(self):
        f = raiser(ValueError)
        with pytest.raises(ValueError):
            f()

    def test_call_raiser_exc_value(self):
        exc = ValueError(14)
        f = raiser(exc)
        with pytest.raises(ValueError) as exc_info:
            f()
        assert exc_info.value is exc

    def test_non_exc_raiser(self):
        with pytest.raises(TypeError):
            raiser("test")


class TestCallRecorder(object):
    def test_call_eq(self):
        assert call(a=2) == call(a=2)
        assert not (call(a=2) != call(a=2))
        assert call(a=2) != call(a=3)
        assert not (call(a=2) == call(a=3))

        assert call() != []

    def test_call_repr(self):
        assert repr(call(1, 2, a=3)) == "<call(1, 2, a=3)>"
        assert repr(call(a=2)) == "<call(a=2)>"

    def test_call_hash(self):
        c1 = call(a=2)
        c2 = call(a=2)
        assert hash(c1) == hash(c2)

    def test_simple(self):
        f = call_recorder(lambda *args, **kwargs: 3)
        assert f() == 3
        assert f.calls == [
            call()
        ]

Reply via email to