Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.

Commit f36761e

Browse files
committed
Fix python tests runner
1 parent 94f63f5 commit f36761e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ mccabe==0.6.1
55
pycodestyle==2.6.0
66
pyflakes==2.2.0
77
yapf==0.30.0
8+
twilio==7.3.2

tools/snippet-testing/language_handler/python.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,20 @@ def self.run_before_test(directory)
1616
end
1717

1818
private
19-
19+
def text_with_custom_header(file_content)
20+
cert_path = ENV['FAKE_CERT_PATH']
21+
file_content.prepend(
22+
"import twilio.rest.resources.base\n"\
23+
"import sys\n"\
24+
"twilio.rest.resources.base.get_cert_file = lambda: '#{cert_path}'\n"\
25+
"sys.modules['twilio.rest.base.resources'] = twilio.rest.resources.base\n"
26+
)
27+
end
28+
def replace_twilio_client_initialization(file_content)
29+
cert_path = ENV['FAKE_CERT_PATH']
30+
file_content.gsub! 'Client(account_sid, auth_token)',
31+
'Client(account_sid, auth_token, http_client=FakerHttpClient())' || file_content
32+
end
2033
def execute_command(file)
2134
command = bash_string_command(
2235
'source /usr/local/bin/virtualenvwrapper.sh &&'\

0 commit comments

Comments
 (0)