Repository navigation
Restore shared state after test fixtures - #23
Open
vinsymoyya wants to merge 1 commit into
Open
vinsymoyya wants to merge 1 commit into
vinsymoyya wants to merge 1 commit into
Conversation
harro
requested changes
Nov 16, 2026
| class FixtureIsolationTest(unittest.TestCase): | ||
|
|
||
| def assertFixtureIsolated(self, name): | ||
| result = subprocess.run( |
Contributor
There was a problem hiding this comment.
This test is pretty involved and I'd rather avoid a subprocess if possible.
Either move the probe into a module or consider using pytest -p randomly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restore process-wide state after test fixtures so unrelated tests can run in either module order. The response fixture replaced the standard
threading.Lock; the inventory fixture left its fetch stub installed; TCLI fixtures leaked synchronization mocks, accessors, progress rendering, flag values, and module bindings.Use scoped patchers and flag savers, preserve the shared FlagValues object's identity, and join the inventory fixture's worker before its class hook is restored. Move end-to-end inventory/accessor selection out of module import side effects and into its class fixture. Production code and existing assertions are unchanged.
Fixes #5.
Dedicated regressions run each of the four fixture lifecycles in a fresh process, check cleanup of shared resources, and exercise real threading afterward. All four fail against current master (
f15c05543241e5faa482d0fae0c2244d456091b7) and pass with the fix.Validation on Linux / Python 3.13:
git diff --checkpasses.enterContext/enterClassContextare available throughout the package's declared Python range (>=3.11). No live device integration was run.