diff --git a/tests/testasciidoc.py b/tests/testasciidoc.py index 347b7beb..35b28eac 100755 --- a/tests/testasciidoc.py +++ b/tests/testasciidoc.py @@ -68,28 +68,6 @@ def normalize_data(lines): return result -def mock_localtime(f, _localtime=time.localtime): - """Mock time module to generate stable output.""" - _frozentime = 0X3DE170D6 - _frozentz = 'UTC+00' - - def _frozen_localtime(t=_frozentime + 1): - assert t > _frozentime, 'File created before first public release' - return _localtime(_frozentime) - - def generate_expected(self, backend): - time.localtime = _frozen_localtime - os.environ['TZ'] = _frozentz - time.tzset() - try: - return f(self, backend) - finally: - time.localtime = _localtime - del os.environ['TZ'] - time.tzset() - return generate_expected - - class AsciiDocTest(object): def __init__(self): self.number = None # Test number (1..). @@ -188,7 +166,6 @@ def get_expected(self, backend): result = [s.rstrip() for s in result] return result - @mock_localtime def generate_expected(self, backend): """ Generate and return test data output for backend. @@ -386,6 +363,8 @@ def read_until(self, regexp): if __name__ == '__main__': + # guarantee a stable timestamp matching the test fixtures + os.environ['SOURCE_DATE_EPOCH'] = '1038184662' # Process command line options. from argparse import ArgumentParser parser = ArgumentParser(description='Run AsciiDoc conformance tests specified in '