Git Product home page Git Product logo

Comments (9)

AdrianTeng avatar AdrianTeng commented on May 14, 2024

Spoke to @mildbyte, he's going to unpin it on a branch and see if any problem arises.

from arctic.

AdrianTeng avatar AdrianTeng commented on May 14, 2024

Have fiddled around with CircleCI's setting. This build is done with mock==1.3.0 and it failes with a bunch of test. Will need to fix those tests before we can upgrade it.

from arctic.

AdrianTeng avatar AdrianTeng commented on May 14, 2024

P.S. This probably blocks #89

from arctic.

bmoscon avatar bmoscon commented on May 14, 2024

yeah I'm looking into it. Most the errors are things like wrong number of arguments, so I'm guessing some of the methods in mock just changed signature

from arctic.

bmoscon avatar bmoscon commented on May 14, 2024

did some research, this is the issue. The problem is that the method that is called (self.set_library_metadata) is wrapped with a decorator. Take off the decorator, and it works. This is the issue, filed with Mock:

testing-cabal/mock#338

from arctic.

bmoscon avatar bmoscon commented on May 14, 2024

really the issue is in the backport of funcsigs to Python2. I opened this issue:

aliles/funcsigs#21

from arctic.

bmoscon avatar bmoscon commented on May 14, 2024

here is an example that reproduces the issue:

import mock
from functools import wraps

def dec(f):
    @wraps(f)
    def f_2(*args, **kwargs):
        pass
    return f_2


class Example(object):
    def __init__(self):
        pass

    @dec
    def method_1(self, arg):
        pass

    def method_2(self, arg):
        self.method_1(arg)



def test_example():
    m = mock.create_autospec(Example)
    Example.method_2(m, "hello")
    m.method_1.assert_called_once_with("hello")

from arctic.

bmoscon avatar bmoscon commented on May 14, 2024

Someone answered the question I posted on stack overflow. They explain why the above will not work and propose a work around, that does work, but isn't really ideal since you'd still have to instantiate the object,

http://stackoverflow.com/questions/34800832/issue-mocking-with-a-decorated-method-call-in-python-2-7/34811786#34811786

from arctic.

bmoscon avatar bmoscon commented on May 14, 2024

This has been resolved in the python 3 branch. I figured out a workaround thanks to an answer on the SO post.

from arctic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.