sqlalchemy / sqlalchemy/dogpile.cache

tests.cache._fixtures._GenericBackendFixture breaks on `tearDown` if the region has args.

Open
#85 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
299
Forks
50
PR merge metrics
No merged PRs in 30d

Description

Migrated issue, originally created by jvanasco (jvanasco)

If the region's class has region_args set, tearDown breaks.

    def tearDown(self):
        if self._region_inst:
-           for key in self._keys:
+           for key in self._keys.copy():  # iterate over a copy, otherwise the dict changes
                self._region_inst.delete(key)
            self._keys.clear()
        elif self._backend_inst:
            self._backend_inst.delete("some_key")

The tearDown is also oversimplified -- it doesn't track or teardown the created keys.. just this example key.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at tests.cache._fixtures._GenericBackendFixture and inspect its tearDown method, especially cleanup when the region class has region_args. Done means teardown no longer fails while deleting tracked keys and also cleans up all created keys rather than only the example key.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.