Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Tests for the Python scripts in ./bin #130

Closed
fabianegli opened this issue Nov 1, 2023 · 2 comments
Closed

Tests for the Python scripts in ./bin #130

fabianegli opened this issue Nov 1, 2023 · 2 comments
Labels
enhancement Improvement for existing functionality

Comments

@fabianegli
Copy link
Contributor

Description of feature

It would be great to have tests for all the quantms pipeline's Python code.

The automated tests would make the development much more enjoyable and have the benefit to speed up development.

There are a couple of considerations:

  • Which test framework to use? I think pytest is the logical choice.
  • How to organize tests? Tests in the same file? Tests in a separate file per script, but in the same folder? tests folder in ./bin/?

Some example of tests for ./bin/diann_convert.py

"""Tests for test_diann_convert.py
"""

from diann_convert import calculate_coverage

def test_calculate_coverage_multiple_incomplete():
    assert calculate_coverage("WATEROVERTHEDUCKSBACK", {"WATER", "DUCK"}) == 0.42857142857142855
def test_calculate_coverage_repeated_complete():
    assert calculate_coverage("DUCKDUCKDUCK", {"DUCK"}) == 1.0
def test_calculate_coverage_incomplete():
    assert calculate_coverage("WATEROVERTHEDUCK", {"DUCK"}) == 0.25
def test_calculate_coverage_overlap_partial_complete():
    assert calculate_coverage("WATER", {"WAT", "TER"}) == 1.0
def test_calculate_coverage_overlap_partial_incomplete():
    assert calculate_coverage("WATERGLASS", {"WAT", "TER"}) == 0.5

NB: the tests require all dependencies of the scripts and hence can not be run on all infrastructure. e.g. there is no openms version for MacOS. So tests might have to be run in containers or some other solution would have to be found.

@fabianegli fabianegli added the enhancement Improvement for existing functionality label Nov 1, 2023
@jpfeuffer
Copy link
Collaborator

Note: (py)OpenMS actually works on macOS. It's just biocondas CI that works in suboptimal ways.

@ypriverol
Copy link
Member

I will close this issue for now because we don't have time to this issue now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Improvement for existing functionality
Projects
None yet
Development

No branches or pull requests

3 participants