keep track of timestamps in terms of the database and allow time to pass between steps.
(s)
| 165 | |
| 166 | |
| 167 | def time_passes(s): |
| 168 | """keep track of timestamps in terms of the database and allow time to |
| 169 | pass between steps.""" |
| 170 | |
| 171 | # close the transaction, if any, since PG time doesn't increment in the |
| 172 | # transaction |
| 173 | s.commit() |
| 174 | |
| 175 | # get "now" in terms of the DB so we can keep the ranges low and |
| 176 | # still have our assertions pass |
| 177 | if times: |
| 178 | time.sleep(1) |
| 179 | |
| 180 | times.append(datetime.datetime.now()) |
| 181 | |
| 182 | if len(times) > 1: |
| 183 | assert times[-1] > times[-2] |
| 184 | return times[-1] |
| 185 | |
| 186 | |
| 187 | e = create_engine("sqlite://", echo="debug") |
no test coverage detected