586 | 586 |
command_contained_test_body_text = False
|
587 | 587 |
command_contained_test_input_file = False
|
588 | 588 |
command_contained_test_input_text = False
|
589 | |
|
590 | |
# DEPRECATED
|
591 | |
if '%(test-file)' in self.command:
|
592 | |
# choose a temp file name and write the body to that file
|
593 | |
fd, test_filename = mkstemp()
|
594 | |
with codecs.open(test_filename, 'w', 'UTF-8') as file:
|
595 | |
file.write(body)
|
596 | |
file.close()
|
597 | |
os.close(fd)
|
598 | |
# replace all occurrences in command
|
599 | |
command = re.sub(r'\%\(test-file\)', test_filename, command)
|
600 | |
command_contained_test_body_file = True
|
601 | |
# DEPRECATED
|
602 | |
if '%(test-text)' in self.command:
|
603 | |
# escape all single quotes in body
|
604 | |
body = re.sub(r"'", r"\'", body)
|
605 | |
# replace all occurrences in command
|
606 | |
command = re.sub(r'\%\(test-text\)', body, command)
|
607 | |
command_contained_test_body_text = True
|
608 | |
|
609 | |
# Preferred over test-file
|
|
589 |
|
610 | 590 |
if '%(test-body-file)' in self.command:
|
611 | 591 |
# choose a temp file name and write the body to that file
|
612 | 592 |
fd, test_filename = mkstemp()
|
|
617 | 597 |
# replace all occurrences in command
|
618 | 598 |
command = re.sub(r'\%\(test-body-file\)', test_filename, command)
|
619 | 599 |
command_contained_test_body_file = True
|
620 | |
# Preferred over test-text
|
|
600 |
|
621 | 601 |
if '%(test-body-text)' in self.command:
|
622 | 602 |
# escape all single quotes in body
|
623 | 603 |
body = re.sub(r"'", r"\'", body)
|
|
636 | 616 |
# replace all occurrences in command
|
637 | 617 |
command = re.sub(r'\%\(test-input-file\)', test_input_filename, command)
|
638 | 618 |
command_contained_test_input_file = True
|
|
619 |
|
639 | 620 |
if '%(test-input-text)' in self.command:
|
640 | 621 |
# escape all single quotes in input
|
641 | 622 |
body = re.sub(r"'", r"\'", body)
|