| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3eda669 commit e6669f9
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -194,6 +194,32 @@ To cleanup the environment delete the container: | |||
| 194 | 194 | docker rm -f gitlab-test | |
| 195 | 195 | docker rm -f gitlab-runner-test | |
| 196 | 196 | ||
| 197 | + Pass options to ``pytest`` | ||
| 198 | + -------------------------- | ||
| 199 | + | ||
| 200 | + Options to ``pytest`` can be passed by adding them after ``--`` when running ``tox``: | ||
| 201 | + | ||
| 202 | + .. code-block:: bash | ||
| 203 | + | ||
| 204 | + tox -e api_func_v4 -- <pytest options>. | ||
| 205 | + | ||
| 206 | + For example, you can use this to run a specific test. Running all tests can be time-consuming, | ||
| 207 | + so this allows you to focus on just the tests relevant to your changes. You can do this by passing | ||
| 208 | + the ``-k`` flag to ``pytest`` and setting a relevant expression to select the tests to run. For example: | ||
| 209 | + | ||
| 210 | + .. code-block:: bash | ||
| 211 | + | ||
| 212 | + # Run all API functional tests from the ``test_projects.py`` file: | ||
| 213 | + tox -e api_func_v4 -- --keep-containers -k test_projects.py | ||
| 214 | + | ||
| 215 | + # Run only the ``test_get_project`` test method from the ``test_projects.py`` file: | ||
| 216 | + tox -e api_func_v4 -- --keep-containers -k "test_projects.py and test_create_project" | ||
| 217 | + | ||
| 218 | + # The above will select all test methods start with ``test_create_project`` from the ``test_projects.py`` file. | ||
| 219 | + # To select only the ``test_create_project`` method, you can exclude other methods by using the ``not`` operator: | ||
| 220 | + tox -e api_func_v4 -- --keep-containers -k "test_projects.py and test_create_project and not test_create_project_" | ||
| 221 | + | ||
| 222 | + | ||
| 197 | 223 | Rerunning failed CI workflows | |
| 198 | 224 | ----------------------------- | |
| 199 | 225 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments