bitranox / fake_winreg Goto Github PK
View Code? Open in Web Editor NEWfake winreg, in order to test registry related functions on linux and windows
License: MIT License
fake winreg, in order to test registry related functions on linux and windows
License: MIT License
I'm submitting a feature request
Do you want to request a feature or report a bug?
Request a feature: Add __enter__
and __exit__
to fake_winreg.fake_winreg.PyHKEY
This functionality exists in winreg
:
with winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) as hive_root:
# Do stuff
hive_root = None
try:
hive_root = fake_winreg.ConnectRegistry(None, fake_winreg.HKEY_LOCAL_MACHINE)
# do stuff
finally:
if hive_root is not None:
hive_root.Close()
with fake_winreg.ConnectRegistry(None, fake_winreg.HKEY_LOCAL_MACHINE) as hive_root:
# Do stuff
And also:
with fake_winreg.OpenKeyEX(hive_root, "Path\To\Key") as key:
# Do stuff
What is the motivation / use case for changing the behavior?
The motivation to add this functionality is to better mock the winreg
module.
Please tell us about your environment:
AttributeError Traceback (most recent call last)
<ipython-input-21-13204fe8e48d> in <module>
----> 1 with fake_winreg.ConnectRegistry(None, fake_winreg.HKEY_LOCAL_MACHINE) as hive_root:
2 pass
3
AttributeError: __enter__
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.