1

class A:
   def exe(self):
       x= threading.Event()
       y= threading.Thread(name=A, target=self.infi, args=(x,), daemon=True)
       y.start()

   def infi(self,x):
      while True:
         ......
         start=True  
         if start:
            start = False
            x.set()
         time.sleep(5)

I wanted to test the exe method inside class A, but the infi method is having an infinite loop so there is no way exit or to stop the code if I wanted to test exec method how should I do it. Can I break the while if so how to do it.

Sanjay
  • 11
  • 2

0 Answers0