superset/scripts/tests
Bogdan 4e340c8368
feat: Switch from nosetest to pytest (#10177)
* Switch from nosetest to pytest

Fix schedule tests

Collect pytest coverage

Move pytest config into pytest.ini

Move cov to the pytest.ini

* Append coverage for the 2nd run

* Add coverage to all commands

* Coverage only for tests

* Get coverage from 1 place

* Rename classes to be  pytest compatible

* Test coverage for examples and tests

* Max diff to -1

* Explain how to run pytest for the whole project

* Do not append code coverage for the main run

* Do not run coverage on examples

Co-authored-by: bogdan kyryliuk <bogdankyryliuk@dropbox.com>
2020-06-29 15:36:06 -07:00
..
README.md tests(celery): improve celery tests infra (#9775) 2020-05-14 16:58:30 +01:00
run.sh feat: Switch from nosetest to pytest (#10177) 2020-06-29 15:36:06 -07:00

README.md

Utility script to run tests faster

By default tests will be run using the Postgres container defined at the docker-compose file on the root of the repo, 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.

Use:

From the superset repo root directory:

  • Example run a single test module:
scripts/tests/run.sh tests.charts.api_tests
  • Example run a single test:
scripts/tests/run.sh tests.charts.api_tests:ChartApiTests.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
scripts/tests/run.sh tests.charts.api_tests:ChartApiTests.test_get_charts --no-init
  • Example for not recreating the test DB (will still run all the tests init procedures)
scripts/tests/run.sh tests.charts.api_tests:ChartApiTests.test_get_charts --no-reset-db
  • Example for not running tests just initialize the test DB (drop/create, upgrade and load examples)
scripts/tests/run.sh . --no-tests
  • Example for just resetting the tests DB
scripts/tests/run.sh . --reset-db