def test_reset_started_stopped(tmpdir): request = Request(0, 1, path=str(tmpdir)) request.start() assert p.exists(p.join(request.path, 'started')) is True request.stop() assert p.exists(p.join(request.path, 'stopped')) is True request.reset_started_stopped() assert p.exists(p.join(request.path, 'started')) is False assert p.exists(p.join(request.path, 'stopped')) is False
def test_stopped(tmpdir): with freezegun.freeze_time('2011-07-26 09:26:00', tz_offset=0): request = Request(0, 1, path=str(tmpdir)) request.stop() with open(os.path.join(request.path, 'stopped'), 'w') as f: print('2011-07-26T09:26:00+00:00\n', file=f) assert request.stopped == datetime.datetime(2011, 7, 26, 9, 26, tzinfo=pytz.utc)