git @ Cat's Eye Technologies Falderal / 1fe9a29
Remove deprecated `%(test-text)` and `%(test-file)` variables. Chris Pressey 7 years ago
4 changed file(s) with 7 addition(s) and 24 deletion(s). Raw diff Collapse all Expand all
33 Version 0.10-PRE "Shedd Aquarium" (current development version):
44
55 * Removed the old, bitrotting Haskell implementation.
6 * Removed deprecated `%(test-text)` and `%(test-file)` variables
7 (`%(test-body-text)` and `%(test-body-file)` should be used now.)
68
79 Version 0.9-2014.0525 "Municipal Pier #2, May 25th 2014" (current released
810 version):
586586 command_contained_test_body_text = False
587587 command_contained_test_input_file = False
588588 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
610590 if '%(test-body-file)' in self.command:
611591 # choose a temp file name and write the body to that file
612592 fd, test_filename = mkstemp()
617597 # replace all occurrences in command
618598 command = re.sub(r'\%\(test-body-file\)', test_filename, command)
619599 command_contained_test_body_file = True
620 # Preferred over test-text
600
621601 if '%(test-body-text)' in self.command:
622602 # escape all single quotes in body
623603 body = re.sub(r"'", r"\'", body)
636616 # replace all occurrences in command
637617 command = re.sub(r'\%\(test-input-file\)', test_input_filename, command)
638618 command_contained_test_input_file = True
619
639620 if '%(test-input-text)' in self.command:
640621 # escape all single quotes in input
641622 body = re.sub(r"'", r"\'", body)
55 to be on `stdout`.
66
77 -> Functionality "Error on stdout" is implemented by shell command
8 -> "python fail.py '%(test-text)' '' 1"
8 -> "python fail.py '%(test-body-text)' '' 1"
99
1010 -> Tests for functionality "Error on stdout"
1111
66 the expected error text.
77
88 -> Functionality "Fail" is implemented by shell command
9 -> "python fail.py foo '%(test-text)' 1"
9 -> "python fail.py foo '%(test-body-text)' 1"
1010
1111 -> Tests for functionality "Fail"
1212