nf-core / tools

Python package with helper tools for the nf-core community.
https://nf-co.re
MIT License
242 stars 191 forks source link

build: Setup VS Code tests #3292

Open edmundmiller opened 4 days ago

edmundmiller commented 4 days ago

Adds VS Code tests. I need someone else to give it a shot locally but it seems to discover them correctly and run them correctly now. It's pretty nice to use.

PR checklist

codecov[bot] commented 4 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 75.74%. Comparing base (207129d) to head (35eb958). Report is 31 commits behind head on dev.

Additional details and impacted files

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

mirpedrol commented 3 days ago

I tried to see the tests in VSCode after checking out to this PR and I see an error

2024-11-22 10:44:05.561 [warning] could not find a pixi interpreter for the interpreter at /opt/homebrew/bin/python3
2024-11-22 10:44:05.576 [warning] could not find a pixi interpreter for the interpreter at /opt/homebrew/bin/python3
2024-11-22 10:44:05.577 [info] > /opt/homebrew/bin/python3 -m pytest -p vscode_pytest --collect-only tests -v --tb=short
2024-11-22 10:44:05.577 [info] cwd: .
2024-11-22 10:44:05.617 [error] /opt/homebrew/opt/python@3.12/bin/python3.12: No module named pytest

2024-11-22 10:44:05.619 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/jmir/Work/tools.
2024-11-22 10:44:05.619 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/jmir/Work/tools. Creating and sending error discovery payload
2024-11-22 10:44:05.619 [error] pytest test discovery error for workspace:  /Users/jmir/Work/tools 

 The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace /Users/jmir/Work/tools

I tried installing pixi with brew install pixi but it didn't work. Am I missing something?

edmundmiller commented 1 hour ago

Ah good catch, I was hoping this would just "pick up" your virtual environment 😞

It should just work with whatever virtualenv you're usually using(if that's not pixi)

Here's the docs on selecting a venv or conda based venv. I've gotten it to work with pixi envs but it doesn't know exactly how to install stuff in that case(but I was using a pixi.toml not pyproject.toml) https://code.visualstudio.com/docs/python/environments#_select-and-activate-an-environment