Guest User

Untitled

a guest
Jun 20th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. def setup_module():
  2. print("Setting up module")
  3.  
  4. def teardown_module():
  5. print("Tearing down module")
  6.  
  7. def setup_function(function):
  8. if function == test1:
  9. print("Setting up test1")
  10. elif function == test2:
  11. print("Setting up test2")
  12. else:
  13. print("Setting up unknow test")
  14.  
  15. def teardown_function(function):
  16. if function == test1:
  17. print("Tearing down test1")
  18. elif function == test2:
  19. print("Tearing down test2")
  20. else:
  21. print("Tearing down unknow test")
  22.  
  23. def test1():
  24. print("Executing test1")
  25. assert True
  26.  
  27. def test2():
  28. print("Executing test2")
  29. assert True
  30.  
  31. class TestClass:
  32. @classmethod
  33. def setup_class(cls):
  34. print("Setup TestClass!")
  35.  
  36. @classmethod
  37. def teardown_class(cls):
  38. print("Teardown TestClass!")
  39.  
  40. def setup_method(self, function):
  41. if function == test1:
  42. print("Setting up test1")
  43. elif function == test2:
  44. print("Setting up test2")
  45. else:
  46. print("Setting up unknow test")
  47.  
  48. def teardown_function(self, function):
  49. if function == test1:
  50. print("Tearing down test1")
  51. elif function == test2:
  52. print("Tearing down test2")
  53. else:
  54. print("Tearing down unknow test")
  55.  
  56. def test1(self):
  57. print("Executing test1 method")
  58. assert True
  59.  
  60. def test2(self):
  61. print("Executing test2 method")
  62. assert True
Add Comment
Please, Sign In to add comment