gabrielfalcao / HTTPretty

Intercept HTTP requests at the Python socket level. Fakes the whole socket module

Home Page:https://httpretty.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why httpretty.enabled(context manager) effect is getting reset after it encounter @httpretty.activate ?

abhinavsp0730 opened this issue · comments

@httpretty.activate
def test_1:
    ... 
    
def test_2:
   ...  
   
   # if test_1 executed first
  with httpretty.enabled(allow_net_connect=False): 
      
      # if any api call happened inside test_1 it'll raise the exception
      test_1()  
      test_2() 
      
   # if test_2 executed first
  with httpretty.enabled(allow_net_connect=False): 
      test_2() 
      # if any api call happened inside test_1 it'll not raise the exception
      test_1()  

Can someone please help my why this is happening? Any way to disable this behaviour?

apologies for opening the issue. Ig I'm dumb 😆