ernestoarbitrio / pytest-runner

vscode extension allows you to run test (in a very quick way) in your 🐍 python codebase using pytest
https://marketplace.visualstudio.com/items?itemName=pamaron.pytest-runner
MIT License
12 stars 0 forks source link

How to use the option `pytest_runner.pytest_options`? #134

Open evandrocoan opened 1 year ago

evandrocoan commented 1 year ago

I added it to my settings file, but it says it is not recognized. image

May be related to: https://github.com/ernestoarbitrio/pytest-runner/pull/61/files

ernestoarbitrio commented 1 year ago

👋 hi, The pytest options section is supposed to be used to add pytest options (https://docs.pytest.org/en/7.1.x/how-to/usage.html), the --use-running-containers is a docker option so you can try to use that in the docker exec command configuration. Hope I have been clear enough. Please let me know

evandrocoan commented 1 year ago

Hi. --use-running-containers is pytest option for the plugin https://github.com/pytest-docker-compose/pytest-docker-compose

I use it on the command line directly with pytest and it works fine: python3 -m pytest mytest --use-running-containers.

VSCode was not complaining about the --use-running-containers option, but it says it does not recognize pytest_runner.pytest_options.

ernestoarbitrio commented 1 year ago

Got it, the pytest_options in the settings files are supposed to be the options specified in the official doc right after the pytest command, for example -s or -x etc... the option you mentioned --use-running-containers should be used at the end of the command I suppose, so this required a change in the plugin. I can make it in the next few weeks or maybe, if you want, you can contribute :D happy to help. Thanks

evandrocoan commented 1 year ago

Hi. I managed to use this option inside my .vscode/settings.json. It looks like a option to pytest.

{
    "python.testing.pytestArgs": [
        ".",
        "--use-running-containers",
    ],

I think it would be appropriate to just update the docs and explain the option pytest_options is just for default pytest options and for other options pytestArgs can be used instead.

ernestoarbitrio commented 1 year ago

great Thanks