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

Commit

Permalink
Fix python tests runner
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisbcc committed Dec 10, 2021
1 parent 94f63f5 commit f36761e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ mccabe==0.6.1
pycodestyle==2.6.0
pyflakes==2.2.0
yapf==0.30.0
twilio==7.3.2
15 changes: 14 additions & 1 deletion tools/snippet-testing/language_handler/python.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,20 @@ def self.run_before_test(directory)
end

private

def text_with_custom_header(file_content)
cert_path = ENV['FAKE_CERT_PATH']
file_content.prepend(
"import twilio.rest.resources.base\n"\
"import sys\n"\
"twilio.rest.resources.base.get_cert_file = lambda: '#{cert_path}'\n"\
"sys.modules['twilio.rest.base.resources'] = twilio.rest.resources.base\n"
)
end
def replace_twilio_client_initialization(file_content)
cert_path = ENV['FAKE_CERT_PATH']
file_content.gsub! 'Client(account_sid, auth_token)',
'Client(account_sid, auth_token, http_client=FakerHttpClient())' || file_content
end
def execute_command(file)
command = bash_string_command(
'source /usr/local/bin/virtualenvwrapper.sh &&'\
Expand Down

0 comments on commit f36761e

Please sign in to comment.