question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

object has no attribute '_memoizedcall' on pytest 6.x

See original GitHub issue

Hi there! I started to use your library for one of my new projects and faced up with the exception like this:

tests/api/personal/test_change_password.py:None (tests/api/personal/test_change_password.py)
.venv/lib/python3.9/site-packages/pytest_describe/plugin.py:134: in _getobj
    return self._memoizedcall('_obj', self._importtestmodule)
E   AttributeError: 'DescribeBlock' object has no attribute '_memoizedcall'

I wrote a little example:

import pytest


@pytest.fixture()
def truelness():
    return True

def describe_pytest_describe():
    def should_work_on_pytest_6():
        assert True


def describe_pytest_describe_with_fixture(truelness):
    def should_work_on_pytest_6():
        assert truelness is True

output:

================================================================================================================ ERRORS ================================================================================================================
________________________________________________________________________________________________ ERROR collecting tests/test_example.py ________________________________________________________________________________________________
.venv/lib/python3.9/site-packages/pytest_describe/plugin.py:134: in _getobj
    return self._memoizedcall('_obj', self._importtestmodule)
E   AttributeError: 'DescribeBlock' object has no attribute '_memoizedcall'

During handling of the above exception, another exception occurred:
.venv/lib/python3.9/site-packages/pytest_describe/plugin.py:136: in _getobj
    return self._importtestmodule()
.venv/lib/python3.9/site-packages/pytest_describe/plugin.py:144: in _importtestmodule
    module = make_module_from_function(self.funcobj)
.venv/lib/python3.9/site-packages/pytest_describe/plugin.py:37: in make_module_from_function
    module.__dict__.update(trace_function(funcobj))
.venv/lib/python3.9/site-packages/pytest_describe/plugin.py:19: in trace_function
    funcobj(*args, **kwargs)
E   TypeError: describe_pytest_describe_with_fixture() missing 1 required positional argument: 'truelness'
======================================================================================================= short test summary info ========================================================================================================
ERROR tests/test_example.py - TypeError: describe_pytest_describe_with_fixture() missing 1 required positional argument: 'truelness'

It looks like a problem with this specific commit in pytest: https://github.com/pytest-dev/pytest/commit/ceb016514b6b62cfe327db1cb5bdc3fef3244900

Could you please take a look?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ROpdebeecommented, Nov 1, 2020

Fixture issue is related to #9 and #11, it’s been a few years so it might be worthwhile to re-evaluate whether it’d be possible to inject fixtures into describe blocks (perhaps limited to class-scope fixtures?)

0reactions
Citocommented, Aug 18, 2021

This should be fixed in 2.0. The fixture issue is now covered in #38. Any help with that one is appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: 'function' object has no attribute 'response_class'
I am trying to write some basic tests for my flask application using pytest. My Folder Structure looks like that:
Read more >
How to use fixtures — pytest documentation
With these fixtures, we can run some code and pass an object back to the requesting fixture/test, just like with the other fixtures....
Read more >
Error AttributeError module object has no attribute tests
I'm running this command: python manage.py test project.apps.app1.tests. and it causes this error: AttributeError: 'module' object has no ...
Read more >
AttributeError: 'TestOne' object has no attribute 'driver'
self.driver. means driver of this object and your code cannot find any variable called driver for that object instance. There is no instance ......
Read more >
AttributeError: 'DatasetConversionInfo' object has no attribute ...
hello,. Yes. Actually, I have already shared the method in the previous message box. I debug the source code and found that the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found