From a02ad29cef71712376aa0b284b4cb2e3aea576fd Mon Sep 17 00:00:00 2001 From: lowercase00 <21188280+lowercase00@users.noreply.github.com> Date: Sun, 12 Feb 2023 22:44:04 -0300 Subject: [PATCH] Docs: Updated testing instructions (#1812) * docs: update rq repo address * docs: detailed test instructions --- docs/contrib/github.md | 2 +- docs/contrib/testing.md | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/docs/contrib/github.md b/docs/contrib/github.md index 18c5bfd7..7445fc0a 100644 --- a/docs/contrib/github.md +++ b/docs/contrib/github.md @@ -3,7 +3,7 @@ title: "Contributing to RQ" layout: contrib --- -If you'd like to contribute to RQ, simply [fork](https://github.com/nvie/rq) +If you'd like to contribute to RQ, simply [fork](https://github.com/rq/rq) the project on GitHub and submit a pull request. Please bear in mind the philosiphy behind RQ: it should rather remain small and diff --git a/docs/contrib/testing.md b/docs/contrib/testing.md index 8abcdc17..91a1598a 100644 --- a/docs/contrib/testing.md +++ b/docs/contrib/testing.md @@ -5,12 +5,45 @@ layout: contrib ### Testing RQ locally -To run tests locally; +To run tests locally you can use `tox`, which will run the tests with all supported Python versions (3.6 - 3.11) ``` tox ``` +Bear in mind that you need to have all those versions installed in your local environment for that to work. + +### Testing with Pytest directly + +For a faster and simpler testing alternative you can just run `pytest` directlyL + +```sh +pytest . +``` + +It should automatically pickup the `tests` directory and run the test suite. +Bear in mind that some tests will be skipped in a local environment - make sure to look at what tests are being skipped. + + +### Skipped Tests + +Apart from skipped tests related to interpreter (eg `PyPy`) or operational systems, slow tests are also skipped by default, but are ran in the GitHub CI/CD workflow. +To include slow tests in your local environment, use the `RUN_SLOW_TESTS_TOO=1` environment variable: + +```sh +RUN_SLOW_TESTS_TOO=1 pytest . +``` + +If you want to analyze the coverage reports, you can use the `--cov` argument to `pytest`: + +```sh +RUN_SLOW_TESTS_TOO=1 pytest --cov=./ --cov-report={{report_format}} --durations=5 +``` + +Where you replace thte `report_format` fot the desired formatting ()`term` / `html` / `xml`). + +### Using Vagrant + If you rather use Vagrant, see [these instructions][v]. [v]: {{site.baseurl}}contrib/vagrant/