GithubHelp home page GithubHelp logo

bitranox / fake_winreg Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 3.0 478 KB

fake winreg, in order to test registry related functions on linux and windows

License: MIT License

Makefile 0.87% Python 85.62% Jupyter Notebook 1.56% Shell 11.34% Batchfile 0.62%

fake_winreg's People

Contributors

bitranox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fake_winreg's Issues

AttributeError when trying to use `with ConnectRegistry()`. PyHKEY does not implement __enter__ and __exit__

  • I'm submitting a feature request

    • bug report
    • feature request
    • support 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
  • What is the current behavior?
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()
  • What is the expected behavior?
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:

  • Module Version : v1.5.6
  • Python Version : 3.7
  • OS, OS Version : Win10 x64
  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow
    , gitter, etc)
    Currently, When trying to execute the above code with fake_winreg an exception is raised:
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__

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.