tests: update test run doc and add some improvements (#10339)

* fix: update tests/run.sh README to pytest and some improvements

* update docs

* nit

* fix doc
This commit is contained in:
Daniel Vaz Gaspar
2020-07-16 13:03:49 +01:00
committed by GitHub
parent 4529812a10
commit e4c9c7364b
2 changed files with 33 additions and 24 deletions

View File

@@ -24,38 +24,50 @@ so prior to using this script make sure to launch the dev containers.
You can use a different DB backend by defining `SUPERSET__SQLALCHEMY_DATABASE_URI` env var.
This script will not install any dependencies for you, so you must be on an already set virtualenv
## Use:
To show all supported switches:
```$bash
scripts/tests/run.sh --help
```
From the superset repo root directory:
- Example run all tests:
```$bash
scripts/tests/run.sh
```
- Example run a single test module:
```$bash
scripts/tests/run.sh tests.charts.api_tests
scripts/tests/run.sh --module tests/charts/api_tests.py
```
- Example run a single test:
```$bash
scripts/tests/run.sh tests.charts.api_tests:ChartApiTests.test_get_charts
scripts/tests/run.sh --module tests/charts/api_tests.py::TestChartApi::test_get_charts
```
- Example run a single test, without any init procedures. Init procedures include:
resetting test database, db upgrade, superset init, loading example data. If your tests
are idempotent, after the first run, subsequent runs are really fast
```$bash
scripts/tests/run.sh tests.charts.api_tests:ChartApiTests.test_get_charts --no-init
scripts/tests/run.sh --module tests/charts/api_tests.py::TestChartApi::test_get_charts --no-init
```
- Example for not recreating the test DB (will still run all the tests init procedures)
```$bash
scripts/tests/run.sh tests.charts.api_tests:ChartApiTests.test_get_charts --no-reset-db
scripts/tests/run.sh --module tests/charts/api_tests.py::TestChartApi::test_get_charts --no-reset-db
```
- Example for not running tests just initialize the test DB (drop/create, upgrade and load examples)
```$bash
scripts/tests/run.sh . --no-tests
scripts/tests/run.sh --no-tests
```
- Example for just resetting the tests DB
```$bash
scripts/tests/run.sh . --reset-db
scripts/tests/run.sh --reset-db --no-tests
```