Show More
@@ -633,16 +633,19 b' class Test(unittest.TestCase):' | |||||
633 | self._testtmp = None |
|
633 | self._testtmp = None | |
634 | self._chgsockdir = None |
|
634 | self._chgsockdir = None | |
635 |
|
635 | |||
|
636 | self._refout = self.readrefout() | |||
|
637 | ||||
|
638 | def readrefout(self): | |||
|
639 | """read reference output""" | |||
636 | # If we're not in --debug mode and reference output file exists, |
|
640 | # If we're not in --debug mode and reference output file exists, | |
637 | # check test output against it. |
|
641 | # check test output against it. | |
638 | if debug: |
|
642 | if self._debug: | |
639 |
|
|
643 | return None # to match "out is None" | |
640 | elif os.path.exists(self.refpath): |
|
644 | elif os.path.exists(self.refpath): | |
641 |
|
|
645 | with open(self.refpath, 'rb') as f: | |
642 |
|
|
646 | return f.read().splitlines(True) | |
643 | f.close() |
|
|||
644 | else: |
|
647 | else: | |
645 |
|
|
648 | return [] | |
646 |
|
649 | |||
647 | # needed to get base class __repr__ running |
|
650 | # needed to get base class __repr__ running | |
648 | @property |
|
651 | @property | |
@@ -1588,6 +1591,11 b' class TestResult(unittest._TextTestResul' | |||||
1588 |
|
1591 | |||
1589 | # handle interactive prompt without releasing iolock |
|
1592 | # handle interactive prompt without releasing iolock | |
1590 | if self._options.interactive: |
|
1593 | if self._options.interactive: | |
|
1594 | if test.readrefout() != expected: | |||
|
1595 | self.stream.write( | |||
|
1596 | 'Reference output has changed (run again to prompt ' | |||
|
1597 | 'changes)') | |||
|
1598 | else: | |||
1591 | self.stream.write('Accept this change? [n] ') |
|
1599 | self.stream.write('Accept this change? [n] ') | |
1592 | answer = sys.stdin.readline().strip() |
|
1600 | answer = sys.stdin.readline().strip() | |
1593 | if answer.lower() in ('y', 'yes'): |
|
1601 | if answer.lower() in ('y', 'yes'): |
@@ -641,6 +641,33 b' Accept the fix' | |||||
641 | $ echo 'saved backup bundle to $TESTTMP/foo.hg' |
|
641 | $ echo 'saved backup bundle to $TESTTMP/foo.hg' | |
642 | saved backup bundle to $TESTTMP/*.hg (glob)< |
|
642 | saved backup bundle to $TESTTMP/*.hg (glob)< | |
643 |
|
643 | |||
|
644 | Race condition - test file was modified when test is running | |||
|
645 | ||||
|
646 | $ TESTRACEDIR=`pwd` | |||
|
647 | $ export TESTRACEDIR | |||
|
648 | $ cat > test-race.t <<EOF | |||
|
649 | > $ echo 1 | |||
|
650 | > $ echo "# a new line" >> $TESTRACEDIR/test-race.t | |||
|
651 | > EOF | |||
|
652 | ||||
|
653 | $ rt -i test-race.t | |||
|
654 | ||||
|
655 | --- $TESTTMP/test-race.t | |||
|
656 | +++ $TESTTMP/test-race.t.err | |||
|
657 | @@ -1,2 +1,3 @@ | |||
|
658 | $ echo 1 | |||
|
659 | + 1 | |||
|
660 | $ echo "# a new line" >> $TESTTMP/test-race.t | |||
|
661 | Reference output has changed (run again to prompt changes) | |||
|
662 | ERROR: test-race.t output changed | |||
|
663 | ! | |||
|
664 | Failed test-race.t: output changed | |||
|
665 | # Ran 1 tests, 0 skipped, 1 failed. | |||
|
666 | python hash seed: * (glob) | |||
|
667 | [1] | |||
|
668 | ||||
|
669 | $ rm test-race.t | |||
|
670 | ||||
644 | (reinstall) |
|
671 | (reinstall) | |
645 | $ mv backup test-failure.t |
|
672 | $ mv backup test-failure.t | |
646 |
|
673 |
General Comments 0
You need to be logged in to leave comments.
Login now