Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: uses non-existing postgresql.time.freeze #22

Open
blueyed opened this issue May 18, 2021 · 3 comments
Open

doc: uses non-existing postgresql.time.freeze #22

blueyed opened this issue May 18, 2021 · 3 comments

Comments

@blueyed
Copy link

blueyed commented May 18, 2021

In https://github.com/CloverHealth/pytest-pgsql/blob/15c99b8ad65a2746970f148c7efb7a9cc8caabcf/docs/index.rst#manipulating-time it has:

with postgresql.time.freeze('December 31st 1999 11:59:59 PM') as freezer:
    # Time is frozen inside the database *and* Python.

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)

@dargueta
Copy link
Contributor

dargueta commented Jun 1, 2021

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.

@vskr
Copy link

vskr commented Aug 14, 2021

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!

@vskr
Copy link

vskr commented Aug 14, 2021

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants