Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup testing environment #4

Open
hyphaltip opened this issue Jun 26, 2024 · 3 comments
Open

Setup testing environment #4

hyphaltip opened this issue Jun 26, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@hyphaltip
Copy link
Member

We need to setup some basic testing env and runs so we understand how to structure the unit test files and datasets for this.

@chtsai0105 I am hoping you can help us get some of the basics started so we have examples of how to write this. We want to build unit tests around the different functions but also simple unit tests to show that dependencies are working.

So far we could use python #3 minimap as well as pysam for some of the steps we need to do instead of installing samtools and minimap2. I wonder if the python bwa mapper works - though I'd want to use a standard version of the software if possible as getting versions correct may vary the results. eg https://github.com/nanoporetech/bwapy

@hyphaltip hyphaltip added enhancement New feature or request help wanted Extra attention is needed labels Jun 26, 2024
@chtsai0105
Copy link
Contributor

Unit test examples have been added in 2f1779f. I'm using pytest to do it so you need to install pytest first:

mamda install pytest

and then go to the root folder of the project, run:

pytest

@chtsai0105
Copy link
Contributor

Note that the unit test is used to test function that do a single action. E.g. the align function inside pipeline.py.

However in a pipeline tool you usually need to combine several functions into a pipeline function. In this case I use pytest.monkeypatch and corresponding mockreturn function to avoid redo the unit test that have already done. E.g. in the test_main_align test function of the tests/main_test.py I used monkeypatch to temporarily replace the align function imported in __main__.py to a mockreturn function, which simply print the keyword arguments and do nothing. By doing so I can test the main function inside __main__.py without truly run the codes.

@hyphaltip
Copy link
Member Author

hyphaltip commented Jun 27, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants