nf-core / nf-core/tools

Speed up `nf-core modules` pytests

Open
#1,737 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement infrastructure
Dominant language
Python
Stars
322
Forks
255
Avg merge
2d 3h
Merged PRs (30d)
5

Description

Description of feature

The pytests for the nf-core modules commands are very slow. I believe this partly due to that every test pulls several remote git repositories in the setUp method. Since all objects that are created by the setUp method are not used by every test, this is unnecessary. We should therefore either move the creation of install objects etc. either to the individual tests or create a test class per modules command with a simpler setUp function. Creating individual classes would also make it easier to test an individual command.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in tests/test_modules.py, especially the setUp method at lines 38–66, and inspect which created objects each modules-command test uses. Run the relevant pytest tests to establish the current runtime, then reduce unnecessary remote repository pulls by moving setup closer to the tests or separating commands into test classes. Done means the tests remain covered and run faster, with individual commands easier to test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.