Skip to content

Commit

Permalink
add more documentation around python testing and linting (apache#13365)
Browse files Browse the repository at this point in the history
  • Loading branch information
eschutho authored Mar 9, 2021
1 parent 139c787 commit ec286f2
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit ec286f2

Please sign in to comment.