DiamondLightSource / python-copier-template

Replacing Diamond Light Source's python3-pip-skeleton using Copier
Apache License 2.0
4 stars 2 forks source link

Bake in pytest config, as the dir is tests #155

Closed stan-dot closed 2 months ago

stan-dot commented 2 months ago

"python.testing.pytestArgs": [ "tests" ], to vscode settings

coretl commented 2 months ago

We do actually want to run pytest on other directories as we want to run doctest on snippets in src and docs as per: https://github.com/DiamondLightSource/python-copier-template/blob/3462fe957ee1f1e2c9495b413a965719f3103460/template/pyproject.toml.jinja#L67-L68

This means that a plain pytest command will actually run pytest src docs tests ..., which should make the addition in settings.json unnecessary

Was this change needed to fix a particular problem?

stan-dot commented 2 months ago

bluesky/blueapi for instance uses only that directory.

the particular problem was vscode not showing the testing left side panel straight away, but asking me to configure tests - first to choose between pytest and unittest and later about the location of directories.

we could add more than 1 location to the settings, that would also work.

callumforrester commented 2 months ago

@stan-dot unsure why it behaved that way for you, it works fine out-of-box for me

stan-dot commented 2 months ago

maybe it's because of devcontainers?

stan-dot commented 2 months ago

no, it's not because of devcontainers

stan-dot commented 2 months ago

@coretl vscode expects the config in its own json, it doesn't read clearly the pyproject.toml

stan-dot commented 2 months ago

solution - likely one needs to wait until the python extension is available