Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail when run in-bulk, but pass when run one-by-one #95

Open
JackHopkins opened this issue Nov 27, 2023 · 0 comments
Open

Tests fail when run in-bulk, but pass when run one-by-one #95

JackHopkins opened this issue Nov 27, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@JackHopkins
Copy link
Contributor

Something is going wrong with the state management.

When we run tests all together, several tests fail with errors such as:

self = <unittest.mock._patch object at 0x119b38650>

    def get_original(self):
        target = self.getter()
        name = self.attribute
    
        original = DEFAULT
        local = False
    
        try:
            original = target.__dict__[name]
        except (AttributeError, KeyError):
            original = getattr(target, name, DEFAULT)
        else:
            local = True
    
        if name in _builtins and isinstance(target, ModuleType):
            self.create = True
    
        if not self.create and original is DEFAULT:
>           raise AttributeError(
                "%s does not have the attribute %r" % (target, name)
            )
E           AttributeError: <module 'test_finance' from '/Users/.../PycharmProjects/monkeyFunctions/tests/test_patch/test_finance.py'> does not have the attribute 'classify_sentiment_2'

This is likely due to how mocked functions are scoped.

@JackHopkins JackHopkins added the bug Something isn't working label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant