Skip to content

Commit

Permalink
test: default tox to 3.8 (deephaven#972)
Browse files Browse the repository at this point in the history
fixes deephaven#965 

Default to test with 3.8

Also adds other environments to run. A tiny bit more maintenance when we
add/remove version support but useful for both the gh action and easily
running different versions locally
  • Loading branch information
jnumainville authored Nov 5, 2024
1 parent b9109e0 commit 103c1e7
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ jobs:
working-directory: 'plugins/${{ inputs.package }}'

- name: Run tox
run: tox -e py
run: tox -e py${{ matrix.python }}
working-directory: 'plugins/${{ inputs.package }}'
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,30 @@ You should be able to pass arguments to these commands as if you were running Pl
It is highly recommended to use `npm run e2e:docker` (instead of `npm run e2e`) as CI also uses the same environment. You can also use `npm run e2e:update-snapshots` to regenerate snapshots in said environment. Run Playwright in [UI Mode](https://playwright.dev/docs/test-ui-mode) with `npm run e2e:ui` when creating new tests or debugging, as this will allow you to run each test individually, see the browser as it runs it, inspect the console, evaluate locators, etc.

### Running Python tests

The above steps will also set up `tox` to run tests for the python plugins that support it.
The [venv setup](#pre-commit-hookspython-formatting) steps will also set up `tox` to run tests for the python plugins that support it.
Note that `tox` sets up an isolated environment for running tests.
Be default, `tox` will run against Python 3.8, which will need to be installed on your system before running tests.
You can run tests with the following command from the `plugins/<plugin>` directory:

```shell
tox -e py
```

> [!IMPORTANT]
> Linux, and possibly other setups such as MacOS depending on method, may require additional packages to be installed to run Python 3.8.
> ```shell
> sudo apt install python3.8 python3.8-distutils libpython3.8
> # or just full install although it will include more packages than necessary
> sudo apt install python3.8-full
> ```

You can also run tests against a specific version of python by appending the version to `py`
This assumes that the version of Python you're targeting is installed on your system.
For example, to run tests against Python 3.12, run:
```shell
tox -e py3.12
```
### Running plugin against deephaven-core
#### Building Python plugins for development
Expand Down
20 changes: 19 additions & 1 deletion plugins/plotly-express/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,22 @@ isolated_build = True
deps =
deephaven-server
commands =
python -m unittest discover
python -m unittest discover
basepython = python3.8

[testenv:py3.8]
basepython = python3.8

[testenv:py3.9]
basepython = python3.9

[testenv:py3.10]
basepython = python3.10

[testenv:py3.11]
basepython = python3.11

[testenv:py3.12]
basepython = python3.12


18 changes: 17 additions & 1 deletion plugins/ui/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,20 @@ isolated_build = True
deps =
deephaven-server
commands =
python -m unittest {posargs}
python -m unittest {posargs}
basepython = python3.8

[testenv:py3.8]
basepython = python3.8

[testenv:py3.9]
basepython = python3.9

[testenv:py3.10]
basepython = python3.10

[testenv:py3.11]
basepython = python3.11

[testenv:py3.12]
basepython = python3.12

0 comments on commit 103c1e7

Please sign in to comment.