Open blueyed opened 3 years ago
~Oops! Yes, please feel free to open a PR with the correction.~
@vskr's solution is correct. @blueyed if you could open a PR to change that to postgresql_db
instead of postgresql
that'd be awesome.
pytest_pgsql.freeze_time
is not a context manager. Can we use with pytest_pgsql.freeze_time
How can we advance(tick or set advance time) using pytest_pgsql.freeze_time. Thanks!
I think postgresql_db or transacted_postgresl_db can be used as context managers. This is how I got it to work for anyone interested in the future:
with transacted_postgresql_db.time.freeze('December 31st 1999 11:59:59 PM') as freezer:
freezer.tick()
In https://github.com/CloverHealth/pytest-pgsql/blob/15c99b8ad65a2746970f148c7efb7a9cc8caabcf/docs/index.rst#manipulating-time it has:
That should probably be
with pytest_pgsql.freeze_time
.It's also in the docs.
Happy to do a PR, but wasn't sure if that was meant really. (the example code then also should have an import probably to make things clearer)