コード例 #1
0
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
コード例 #2
0
def test_started(tmpdir):
    with freezegun.freeze_time('2011-07-26 09:25:00', tz_offset=0):
        request = Request(0, 1, path=str(tmpdir))
        request.start()
        with open(os.path.join(request.path, 'started'), 'w') as f:
            print('2011-07-26T09:25:00+00:00\n', file=f)
        assert request.started == datetime.datetime(2011,
                                                    7,
                                                    26,
                                                    9,
                                                    25,
                                                    tzinfo=pytz.utc)