mirror of https://github.com/apache/superset.git
add more documentation around python testing and linting (#13365)
This commit is contained in:
parent
139c7878a5
commit
ec286f27c4
|
@ -579,12 +579,19 @@ pip3 install -r requirements/integration.txt
|
|||
pre-commit install
|
||||
```
|
||||
|
||||
A series of checks will now run when you make a git commit.
|
||||
|
||||
Alternatively it is possible to run pre-commit via tox:
|
||||
|
||||
```bash
|
||||
tox -e pre-commit
|
||||
```
|
||||
|
||||
Or by running pre-commit manually:
|
||||
```bash
|
||||
pre-commit run --all-files
|
||||
```
|
||||
|
||||
## Linting
|
||||
|
||||
Lint the project with:
|
||||
|
@ -593,15 +600,17 @@ Lint the project with:
|
|||
# for python
|
||||
tox -e pylint
|
||||
|
||||
Alternatively, you can use pre-commit (mentioned above) for python linting
|
||||
|
||||
The Python code is auto-formatted using [Black](https://github.com/python/black) which
|
||||
is configured as a pre-commit hook. There are also numerous [editor integrations](https://black.readthedocs.io/en/stable/editor_integration.html)
|
||||
|
||||
# for frontend
|
||||
cd superset-frontend
|
||||
npm ci
|
||||
npm run lint
|
||||
```
|
||||
|
||||
The Python code is auto-formatted using [Black](https://github.com/python/black) which
|
||||
is configured as a pre-commit hook. There are also numerous [editor integrations](https://black.readthedocs.io/en/stable/editor_integration.html).
|
||||
|
||||
## Conventions
|
||||
|
||||
### Python
|
||||
|
@ -687,6 +696,14 @@ Note that the test environment uses a temporary directory for defining the
|
|||
SQLite databases which will be cleared each time before the group of test
|
||||
commands are invoked.
|
||||
|
||||
There is also a utility script included in the Superset codebase to run python tests. The [readme can be
|
||||
found here](https://github.com/apache/superset/tree/master/scripts/tests)
|
||||
|
||||
To run all tests for example, run this script from the root directory:
|
||||
```bash
|
||||
scripts/tests/run.sh
|
||||
```
|
||||
|
||||
### Frontend Testing
|
||||
|
||||
We use [Jest](https://jestjs.io/) and [Enzyme](https://airbnb.io/enzyme/) to test TypeScript/JavaScript. Tests can be run with:
|
||||
|
|
Loading…
Reference in New Issue