Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
SourceryAI authored and miketheman committed Mar 22, 2021
1 parent abc3016 commit 1117e59
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/test_restrict_hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ def assert_socket_connect(should_pass, **kwargs):
code_template = kwargs.get('code_template', connect_code_template)
mark_arg = kwargs.get('mark_arg', None)

if mark_arg and isinstance(mark_arg, str):
mark = '@pytest.mark.allow_hosts("{0}")'.format(mark_arg)
elif mark_arg and isinstance(mark_arg, list):
mark = '@pytest.mark.allow_hosts(["{0}"])'.format('","'.join(mark_arg))
if mark_arg:
if isinstance(mark_arg, str):
mark = '@pytest.mark.allow_hosts("{0}")'.format(mark_arg)
elif isinstance(mark_arg, list):
mark = '@pytest.mark.allow_hosts(["{0}"])'.format('","'.join(mark_arg))
code = code_template.format(test_url.hostname, test_url.port, test_name, mark)
testdir.makepyfile(code)

Expand Down

0 comments on commit 1117e59

Please sign in to comment.