-
Notifications
You must be signed in to change notification settings - Fork 76
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
Documentation for PostgreSQL integration testing #663
Conversation
Hello @edublancas I will be pushing the initial draft of a file shortly. |
0a8eeeb
to
22cb1a3
Compare
@edublancas I have pushed the initial draft of test document to the repo. Should I make it available for review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you run the commands you added to the tutorial? I believe dockerctx depends on psycopg2, so psycopg2 should be installed before dockerctx.
Also, I don't think %pytest
will work.
It'd be better to run the commands to ensure they actually work: https://ploomber-contributing.readthedocs.io/en/latest/documentation/notebooks.html
also, the docs are failing. check the logs and fix the warnings.
Not able to see the docs preview. Please fix the build and re-request for review |
Sure, will do that. Should I make this a markdown file and move it under tutorials/ ? |
No. keep it as an ipynb. add if in the same section as the one documenting how to run integration tests |
updated the doc as per requested changes, and fixed the build warnings. now docs is up. |
apologies for accidentally tagging @yafimvo for review due to yaml change, reverted the change already |
…gres-test merging with master to update ci.yml fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like you're missing a changelog entry. please add
also, if you look at the integration tests implementation, you'll see that it's unnecessary to run the docker commands, as the test will spin up the container when it starts.
another thing I noticed when running your commands is that pytest will take ~1 minute to fail if I'm missing psycopg2, looks like we have an issue in the setup because missing a package should exit the command fairly quickly with an error message. so please investigate what's going on
Yes that's right, removed the docker run part from doc and updated the changelog. |
Hello, can't seem to reproduce this issue on my end. I tried setting up entirely new environment, where it doesn't let me install dockerctx without psycopg2, hence pytest instantly fails over dockerctx. What's exactly happening on your end? |
@ha2179 looks like yours is failing fast because you explicitly added this would imply that we'd have to add an
|
Nope, I didn't edit anything. The Here's how complete traceback looks on my side - src/tests/integration/test_generic_db_operations.py:51:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../opt/anaconda3/envs/jupysql/lib/python3.10/site-packages/_pytest/fixtures.py:585: in getfixturevalue
fixturedef = self._get_active_fixturedef(argname)
../../opt/anaconda3/envs/jupysql/lib/python3.10/site-packages/_pytest/fixtures.py:607: in _get_active_fixturedef
self._compute_fixture_value(fixturedef)
../../opt/anaconda3/envs/jupysql/lib/python3.10/site-packages/_pytest/fixtures.py:693: in _compute_fixture_value
fixturedef.execute(request=subrequest)
../../opt/anaconda3/envs/jupysql/lib/python3.10/site-packages/_pytest/fixtures.py:1045: in execute
fixturedef = request._get_active_fixturedef(argname)
../../opt/anaconda3/envs/jupysql/lib/python3.10/site-packages/_pytest/fixtures.py:607: in _get_active_fixturedef
self._compute_fixture_value(fixturedef)
../../opt/anaconda3/envs/jupysql/lib/python3.10/site-packages/_pytest/fixtures.py:693: in _compute_fixture_value
fixturedef.execute(request=subrequest)
../../opt/anaconda3/envs/jupysql/lib/python3.10/site-packages/_pytest/fixtures.py:1069: in execute
result = ihook.pytest_fixture_setup(fixturedef=self, request=request)
../../opt/anaconda3/envs/jupysql/lib/python3.10/site-packages/pluggy/_hooks.py:433: in __call__
return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
../../opt/anaconda3/envs/jupysql/lib/python3.10/site-packages/pluggy/_manager.py:112: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
../../opt/anaconda3/envs/jupysql/lib/python3.10/site-packages/_pytest/fixtures.py:1123: in pytest_fixture_setup
result = call_fixture_func(fixturefunc, request, kwargs)
../../opt/anaconda3/envs/jupysql/lib/python3.10/site-packages/_pytest/fixtures.py:895: in call_fixture_func
fixture_result = next(generator)
src/tests/integration/conftest.py:102: in setup_postgreSQL
engine = create_engine(
<string>:2: in create_engine
???
../../opt/anaconda3/envs/jupysql/lib/python3.10/site-packages/sqlalchemy/util/deprecations.py:281: in warned
return fn(*args, **kwargs) # type: ignore[no-any-return]
../../opt/anaconda3/envs/jupysql/lib/python3.10/site-packages/sqlalchemy/engine/create.py:601: in create_engine
dbapi = dbapi_meth(**dbapi_args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2'>
@classmethod
def import_dbapi(cls):
> import psycopg2
E ModuleNotFoundError: No module named 'psycopg2'
../../opt/anaconda3/envs/jupysql/lib/python3.10/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py:669: ModuleNotFoundError Really surprised why it's taking so much longer to fail on your side despite failing with exact same error. |
are you starting the container manually? because I'm not (the tests are configured to start one if needed). I think the overhead might come from that |
Spotted it. Apparently there was stopped container mapped to the port, maybe that was expediting it. Now, it's taking ~1 min for me as well. Will track down what's happening! |
@edublancas found the root cause - Should we change this to some lower amount like ~10 secs?
|
fixed postgres test timeout issue
Describe your changes
Added postgreSQL Test Documentation ipynb file; opening draft PR
Issue number
Closes 643
Checklist before requesting a review
pkgmt format
📚 Documentation preview 📚: https://jupysql--663.org.readthedocs.build/en/663/