Skip to content

[MOD-15868/MOD-15876] env: allow substituting Env subclass via Defaults.env_class#254

Open
ofiryanai wants to merge 1 commit into
masterfrom
mod-15876-env-class-hook
Open

[MOD-15868/MOD-15876] env: allow substituting Env subclass via Defaults.env_class#254
ofiryanai wants to merge 1 commit into
masterfrom
mod-15876-env-class-hook

Conversation

@ofiryanai

Copy link
Copy Markdown

Adds a small, generic construction hook so a consumer can substitute an Env subclass for bare Env(...) construction, without monkeypatching:

  • Defaults.env_class (default None)
  • Env.__new__ returns Defaults.env_class when the bare Env is constructed and a class is set (the pathlib.PathPosixPath idiom).

When env_class is None behavior is unchanged, so this is a no-op for existing users. It lets the RediSearch pytest suite run against the enterprise module via a proper Env subclass (RediSearch#10205) instead of monkeypatching Env in place — covering both fixture-injected def testX(env) tests (via Defaults.env_factory) and the ~45 files that construct Env(...) directly.

No RediSearch-specific logic here; all module-specific behavior stays in the RediSearch suite.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant