1
0

zypp_plugin.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # -*- coding: utf-8 -*-
  2. """
  3. Related to zypp_plugins_test.py module.
  4. """
  5. class Plugin(object):
  6. """
  7. Bogus module for Zypp Plugins tests.
  8. """
  9. def ack(self):
  10. """
  11. Acknowledge that the plugin had finished the transaction
  12. Returns:
  13. """
  14. def main(self):
  15. """
  16. Register plugin
  17. Returns:
  18. """
  19. class BogusIO(object):
  20. """
  21. Read/write logger.
  22. """
  23. def __init__(self):
  24. self.content = list()
  25. self.closed = False
  26. def __str__(self):
  27. return "\n".join(self.content)
  28. def __call__(self, *args, **kwargs):
  29. self.path, self.mode = args
  30. return self
  31. def __exit__(self, exc_type, exc_val, exc_tb):
  32. self.close()
  33. def __enter__(self):
  34. return self
  35. def write(self, data):
  36. """
  37. Simulate writing data
  38. Args:
  39. data:
  40. Returns:
  41. """
  42. self.content.append(data)
  43. def close(self):
  44. """
  45. Simulate closing the IO object.
  46. Returns:
  47. """
  48. self.closed = True