-
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
documenting how to run integration tests locally #380
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,10 +19,28 @@ myst: | |
|
||
# Developer guide | ||
|
||
Before continuing, ensure you have a working [development environment.](https://ploomber-contributing.readthedocs.io/en/latest/contributing/setup.html) | ||
|
||
+++ | ||
|
||
## Unit testing | ||
|
||
### Running tests | ||
|
||
Unit tests are executed on each PR; however, you might need to run them locally. | ||
|
||
To run all unit tests: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i believe that with my added tests on the #319 change, running all unit tests locally started to fail due to a
another environment issue specific only to my mac, but having instructions published here in case other users encounter it might be worth writing since 256 is the default for macs. |
||
|
||
```sh | ||
pytest --ignore=src/tests/integration | ||
``` | ||
|
||
To run a specific file: | ||
|
||
```sh | ||
pytest src/tests/TEST_FILE_NAME.py | ||
``` | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is also helpful to include how to run a specific test in a file likeso: pytest src/tests/test_magic.py::test_save_with_trailing_semicolon |
||
### Magics (e.g., `%sql`, `%%sql`, etc) | ||
|
||
This guide will show you the basics of writing unit tests for JupySQL magics. Magics are commands that begin with `%` (line magics) and `%%` (cell magics). | ||
|
@@ -135,3 +153,51 @@ with pytest.raises(ZeroDivisionError) as excinfo: | |
```{code-cell} ipython3 | ||
assert str(excinfo.value) == "division by zero" | ||
``` | ||
|
||
## Integration tests | ||
|
||
Integration tests check compatibility with different databases. They are executed on | ||
each PR; however, you might need to run them locally. | ||
|
||
```{note} | ||
Setting up the development environment for running integration tests locally | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps, consider adding another note here to push developers to rely on the CI to test PRs since integration tests are not yet supported on all OSes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might also be helpful to include which OSes are supported |
||
is challenging given the number of dependencies. If you have problems, | ||
[message us on Slack.](https://ploomber.io/community) | ||
``` | ||
|
||
Ensure you have [Docker Desktop](https://docs.docker.com/desktop/) before continuing. | ||
|
||
To install all dependencies: | ||
|
||
```sh | ||
# create development environment (you can skip this if you already executed it) | ||
pkgmt setup | ||
|
||
# activate environment | ||
conda activate jupysql | ||
|
||
# install depdencies | ||
pip install -e '.[integration]' | ||
idomic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
```{tip} | ||
Ensure Docker is running before continuing! | ||
``` | ||
|
||
To run all integration tests (the tests are pre-configured to start and shut down | ||
the required Docker images): | ||
|
||
```sh | ||
pytest src/tests/integration | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I get to this step, I received the error:
Running |
||
``` | ||
|
||
```{important} | ||
If you're using **Windows**, the command above might get stuck. Send us a [message on Slack](https://ploomber.io/community) if it happens. | ||
``` | ||
|
||
To run some of the tests: | ||
|
||
```sh | ||
pytest src/tests/integration/test_generic_db_operations.py::test_profile_query | ||
``` | ||
Comment on lines
+187
to
+202
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency with the unit testing section, I would recommend this:
|
||
|
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.
I think that this entire developer-guide.md file should be renamed and moved into a "Testing" -> "JupySQL" section within the contributing portal
I also found it a bit difficult to navigate to the contribution docs from the main website, and would suggest just making the "Developer guide" link pictured below directly go to Contributing since that covers all development instructions for all of your projects
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.