Skip to content

INTERNALERROR> AttributeError: 'Config' object has no attribute 'cache' #130

@whhsu2

Description

@whhsu2

Bug Report

Environment
pytest==8.3.0, pytest-memray==1.7.0

Repro Steps
pytest --memray -p no:cacheprovider gets the error

    if _config.cache is not None:
AttributeError: 'Config' object has no attribute 'cache'

This is due to here:

if _config.cache is not None:

    if _config.cache is not None:
        cache = _config.cache.get(f"memray/{_test_id}", {})
        previous = cache.get("total_allocated_memory", float("inf"))

Expected behavior/code
Able to run pytest memray without the cacheprovider plugin

Possible Solution
Replace if _config.cache is not None: with if getattr(_config, 'cache', None) is not None:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions